Mercurial > hg > soundsoftware-site
comparison test/functional/welcome_controller_test.rb @ 524:1248a47e81b3 feature_36
Merge from branch "luisf"
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 25 Jul 2011 14:39:38 +0100 |
parents | 051f544170fe |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
519:3be6bc3c2a17 | 524:1248a47e81b3 |
---|---|
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../test_helper' | 18 require File.expand_path('../../test_helper', __FILE__) |
19 require 'welcome_controller' | 19 require 'welcome_controller' |
20 | 20 |
21 # Re-raise errors caught by the controller. | 21 # Re-raise errors caught by the controller. |
22 class WelcomeController; def rescue_action(e) raise e end; end | 22 class WelcomeController; def rescue_action(e) raise e end; end |
23 | 23 |
65 get :robots | 65 get :robots |
66 assert_response :success | 66 assert_response :success |
67 assert_equal 'text/plain', @response.content_type | 67 assert_equal 'text/plain', @response.content_type |
68 assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) | 68 assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) |
69 end | 69 end |
70 | |
71 def test_warn_on_leaving_unsaved_turn_on | |
72 user = User.find(2) | |
73 user.pref.warn_on_leaving_unsaved = '1' | |
74 user.pref.save! | |
75 @request.session[:user_id] = 2 | |
76 | |
77 get :index | |
78 assert_tag 'script', | |
79 :attributes => {:type => "text/javascript"}, | |
80 :content => %r{new WarnLeavingUnsaved} | |
81 end | |
82 | |
83 def test_warn_on_leaving_unsaved_turn_off | |
84 user = User.find(2) | |
85 user.pref.warn_on_leaving_unsaved = '0' | |
86 user.pref.save! | |
87 @request.session[:user_id] = 2 | |
88 | |
89 get :index | |
90 assert_no_tag 'script', | |
91 :attributes => {:type => "text/javascript"}, | |
92 :content => %r{new WarnLeavingUnsaved} | |
93 end | |
70 end | 94 end |