@@ -64,7 +64,7 class AccountControllerTest < ActionController::TestCase | |||||
64 | assert existing_user.save! |
|
64 | assert existing_user.save! | |
65 |
|
65 | |||
66 | post :login, :openid_url => existing_user.identity_url |
|
66 | post :login, :openid_url => existing_user.identity_url | |
67 | assert_redirected_to 'my/page' |
|
67 | assert_redirected_to '/my/page' | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def test_login_with_invalid_openid_provider |
|
70 | def test_login_with_invalid_openid_provider | |
@@ -86,14 +86,14 class AccountControllerTest < ActionController::TestCase | |||||
86 | assert existing_user.save! |
|
86 | assert existing_user.save! | |
87 |
|
87 | |||
88 | post :login, :openid_url => existing_user.identity_url |
|
88 | post :login, :openid_url => existing_user.identity_url | |
89 | assert_redirected_to 'login' |
|
89 | assert_redirected_to '/login' | |
90 | end |
|
90 | end | |
91 |
|
91 | |||
92 | def test_login_with_openid_with_new_user_created |
|
92 | def test_login_with_openid_with_new_user_created | |
93 | Setting.self_registration = '3' |
|
93 | Setting.self_registration = '3' | |
94 | Setting.openid = '1' |
|
94 | Setting.openid = '1' | |
95 | post :login, :openid_url => 'http://openid.example.com/good_user' |
|
95 | post :login, :openid_url => 'http://openid.example.com/good_user' | |
96 | assert_redirected_to 'my/account' |
|
96 | assert_redirected_to '/my/account' | |
97 | user = User.find_by_login('cool_user') |
|
97 | user = User.find_by_login('cool_user') | |
98 | assert user |
|
98 | assert user | |
99 | assert_equal 'Cool', user.firstname |
|
99 | assert_equal 'Cool', user.firstname | |
@@ -113,7 +113,7 class AccountControllerTest < ActionController::TestCase | |||||
113 | Setting.self_registration = '1' |
|
113 | Setting.self_registration = '1' | |
114 | Setting.openid = '1' |
|
114 | Setting.openid = '1' | |
115 | post :login, :openid_url => 'http://openid.example.com/good_user' |
|
115 | post :login, :openid_url => 'http://openid.example.com/good_user' | |
116 | assert_redirected_to 'login' |
|
116 | assert_redirected_to '/login' | |
117 | user = User.find_by_login('cool_user') |
|
117 | user = User.find_by_login('cool_user') | |
118 | assert user |
|
118 | assert user | |
119 |
|
119 | |||
@@ -125,7 +125,7 class AccountControllerTest < ActionController::TestCase | |||||
125 | Setting.self_registration = '2' |
|
125 | Setting.self_registration = '2' | |
126 | Setting.openid = '1' |
|
126 | Setting.openid = '1' | |
127 | post :login, :openid_url => 'http://openid.example.com/good_user' |
|
127 | post :login, :openid_url => 'http://openid.example.com/good_user' | |
128 | assert_redirected_to 'login' |
|
128 | assert_redirected_to '/login' | |
129 | user = User.find_by_login('cool_user') |
|
129 | user = User.find_by_login('cool_user') | |
130 | assert user |
|
130 | assert user | |
131 | assert_equal User::STATUS_REGISTERED, user.status |
|
131 | assert_equal User::STATUS_REGISTERED, user.status | |
@@ -157,7 +157,7 class AccountControllerTest < ActionController::TestCase | |||||
157 | def test_logout |
|
157 | def test_logout | |
158 | @request.session[:user_id] = 2 |
|
158 | @request.session[:user_id] = 2 | |
159 | get :logout |
|
159 | get :logout | |
160 | assert_redirected_to '' |
|
160 | assert_redirected_to '/' | |
161 | assert_nil @request.session[:user_id] |
|
161 | assert_nil @request.session[:user_id] | |
162 | end |
|
162 | end | |
163 |
|
163 |
@@ -95,7 +95,7 class AttachmentsControllerTest < ActionController::TestCase | |||||
95 | post :destroy, :id => 1 |
|
95 | post :destroy, :id => 1 | |
96 | end |
|
96 | end | |
97 | # no referrer |
|
97 | # no referrer | |
98 | assert_redirected_to 'projects/ecookbook' |
|
98 | assert_redirected_to '/projects/ecookbook' | |
99 | assert_nil Attachment.find_by_id(1) |
|
99 | assert_nil Attachment.find_by_id(1) | |
100 | j = issue.journals.find(:first, :order => 'created_on DESC') |
|
100 | j = issue.journals.find(:first, :order => 'created_on DESC') | |
101 | assert_equal 'attachment', j.details.first.property |
|
101 | assert_equal 'attachment', j.details.first.property |
@@ -27,7 +27,7 class CommentsControllerTest < ActionController::TestCase | |||||
27 | def test_add_comment |
|
27 | def test_add_comment | |
28 | @request.session[:user_id] = 2 |
|
28 | @request.session[:user_id] = 2 | |
29 | post :create, :id => 1, :comment => { :comments => 'This is a test comment' } |
|
29 | post :create, :id => 1, :comment => { :comments => 'This is a test comment' } | |
30 | assert_redirected_to 'news/1' |
|
30 | assert_redirected_to '/news/1' | |
31 |
|
31 | |||
32 | comment = News.find(1).comments.find(:first, :order => 'created_on DESC') |
|
32 | comment = News.find(1).comments.find(:first, :order => 'created_on DESC') | |
33 | assert_not_nil comment |
|
33 | assert_not_nil comment | |
@@ -40,7 +40,7 class CommentsControllerTest < ActionController::TestCase | |||||
40 | assert_no_difference 'Comment.count' do |
|
40 | assert_no_difference 'Comment.count' do | |
41 | post :create, :id => 1, :comment => { :comments => '' } |
|
41 | post :create, :id => 1, :comment => { :comments => '' } | |
42 | assert_response :redirect |
|
42 | assert_response :redirect | |
43 | assert_redirected_to 'news/1' |
|
43 | assert_redirected_to '/news/1' | |
44 | end |
|
44 | end | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
@@ -48,7 +48,7 class CommentsControllerTest < ActionController::TestCase | |||||
48 | comments_count = News.find(1).comments.size |
|
48 | comments_count = News.find(1).comments.size | |
49 | @request.session[:user_id] = 2 |
|
49 | @request.session[:user_id] = 2 | |
50 | delete :destroy, :id => 1, :comment_id => 2 |
|
50 | delete :destroy, :id => 1, :comment_id => 2 | |
51 | assert_redirected_to 'news/1' |
|
51 | assert_redirected_to '/news/1' | |
52 | assert_nil Comment.find_by_id(2) |
|
52 | assert_nil Comment.find_by_id(2) | |
53 | assert_equal comments_count - 1, News.find(1).comments.size |
|
53 | assert_equal comments_count - 1, News.find(1).comments.size | |
54 | end |
|
54 | end |
@@ -77,7 +77,7 LOREM | |||||
77 | :category_id => 2}, |
|
77 | :category_id => 2}, | |
78 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
|
78 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} | |
79 |
|
79 | |||
80 | assert_redirected_to 'projects/ecookbook/documents' |
|
80 | assert_redirected_to '/projects/ecookbook/documents' | |
81 |
|
81 | |||
82 | document = Document.find_by_title('DocumentsControllerTest#test_post_new') |
|
82 | document = Document.find_by_title('DocumentsControllerTest#test_post_new') | |
83 | assert_not_nil document |
|
83 | assert_not_nil document | |
@@ -90,7 +90,7 LOREM | |||||
90 | def test_destroy |
|
90 | def test_destroy | |
91 | @request.session[:user_id] = 2 |
|
91 | @request.session[:user_id] = 2 | |
92 | post :destroy, :id => 1 |
|
92 | post :destroy, :id => 1 | |
93 | assert_redirected_to 'projects/ecookbook/documents' |
|
93 | assert_redirected_to '/projects/ecookbook/documents' | |
94 | assert_nil Document.find_by_id(1) |
|
94 | assert_nil Document.find_by_id(1) | |
95 | end |
|
95 | end | |
96 | end |
|
96 | end |
@@ -37,7 +37,7 class FilesControllerTest < ActionController::TestCase | |||||
37 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
|
37 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} | |
38 | assert_response :redirect |
|
38 | assert_response :redirect | |
39 | end |
|
39 | end | |
40 | assert_redirected_to 'projects/ecookbook/files' |
|
40 | assert_redirected_to '/projects/ecookbook/files' | |
41 | a = Attachment.find(:first, :order => 'created_on DESC') |
|
41 | a = Attachment.find(:first, :order => 'created_on DESC') | |
42 | assert_equal 'testfile.txt', a.filename |
|
42 | assert_equal 'testfile.txt', a.filename | |
43 | assert_equal Project.find(1), a.container |
|
43 | assert_equal Project.find(1), a.container | |
@@ -58,7 +58,7 class FilesControllerTest < ActionController::TestCase | |||||
58 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
|
58 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} | |
59 | assert_response :redirect |
|
59 | assert_response :redirect | |
60 | end |
|
60 | end | |
61 | assert_redirected_to 'projects/ecookbook/files' |
|
61 | assert_redirected_to '/projects/ecookbook/files' | |
62 | a = Attachment.find(:first, :order => 'created_on DESC') |
|
62 | a = Attachment.find(:first, :order => 'created_on DESC') | |
63 | assert_equal 'testfile.txt', a.filename |
|
63 | assert_equal 'testfile.txt', a.filename | |
64 | assert_equal Version.find(2), a.container |
|
64 | assert_equal Version.find(2), a.container |
@@ -54,7 +54,7 class GroupsControllerTest < ActionController::TestCase | |||||
54 | assert_difference 'Group.count' do |
|
54 | assert_difference 'Group.count' do | |
55 | post :create, :group => {:lastname => 'New group'} |
|
55 | post :create, :group => {:lastname => 'New group'} | |
56 | end |
|
56 | end | |
57 | assert_redirected_to 'groups' |
|
57 | assert_redirected_to '/groups' | |
58 | end |
|
58 | end | |
59 |
|
59 | |||
60 | def test_edit |
|
60 | def test_edit | |
@@ -65,14 +65,14 class GroupsControllerTest < ActionController::TestCase | |||||
65 |
|
65 | |||
66 | def test_update |
|
66 | def test_update | |
67 | post :update, :id => 10 |
|
67 | post :update, :id => 10 | |
68 | assert_redirected_to 'groups' |
|
68 | assert_redirected_to '/groups' | |
69 | end |
|
69 | end | |
70 |
|
70 | |||
71 | def test_destroy |
|
71 | def test_destroy | |
72 | assert_difference 'Group.count', -1 do |
|
72 | assert_difference 'Group.count', -1 do | |
73 | post :destroy, :id => 10 |
|
73 | post :destroy, :id => 10 | |
74 | end |
|
74 | end | |
75 | assert_redirected_to 'groups' |
|
75 | assert_redirected_to '/groups' | |
76 | end |
|
76 | end | |
77 |
|
77 | |||
78 | def test_add_users |
|
78 | def test_add_users |
@@ -72,7 +72,7 class IssueMovesControllerTest < ActionController::TestCase | |||||
72 | post :create, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'} |
|
72 | post :create, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'} | |
73 | end |
|
73 | end | |
74 | end |
|
74 | end | |
75 | assert_redirected_to 'projects/ecookbook/issues' |
|
75 | assert_redirected_to '/projects/ecookbook/issues' | |
76 | end |
|
76 | end | |
77 |
|
77 | |||
78 | context "#create via bulk copy" do |
|
78 | context "#create via bulk copy" do |
@@ -87,7 +87,7 class MessagesControllerTest < ActionController::TestCase | |||||
87 | :content => 'Message body'} |
|
87 | :content => 'Message body'} | |
88 | message = Message.find_by_subject('Test created message') |
|
88 | message = Message.find_by_subject('Test created message') | |
89 | assert_not_nil message |
|
89 | assert_not_nil message | |
90 | assert_redirected_to "boards/1/topics/#{message.to_param}" |
|
90 | assert_redirected_to "/boards/1/topics/#{message.to_param}" | |
91 | assert_equal 'Message body', message.content |
|
91 | assert_equal 'Message body', message.content | |
92 | assert_equal 2, message.author_id |
|
92 | assert_equal 2, message.author_id | |
93 | assert_equal 1, message.board_id |
|
93 | assert_equal 1, message.board_id | |
@@ -114,7 +114,7 class MessagesControllerTest < ActionController::TestCase | |||||
114 | post :edit, :board_id => 1, :id => 1, |
|
114 | post :edit, :board_id => 1, :id => 1, | |
115 | :message => { :subject => 'New subject', |
|
115 | :message => { :subject => 'New subject', | |
116 | :content => 'New body'} |
|
116 | :content => 'New body'} | |
117 | assert_redirected_to 'boards/1/topics/1' |
|
117 | assert_redirected_to '/boards/1/topics/1' | |
118 | message = Message.find(1) |
|
118 | message = Message.find(1) | |
119 | assert_equal 'New subject', message.subject |
|
119 | assert_equal 'New subject', message.subject | |
120 | assert_equal 'New body', message.content |
|
120 | assert_equal 'New body', message.content | |
@@ -124,14 +124,14 class MessagesControllerTest < ActionController::TestCase | |||||
124 | @request.session[:user_id] = 2 |
|
124 | @request.session[:user_id] = 2 | |
125 | post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } |
|
125 | post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } | |
126 | reply = Message.find(:first, :order => 'id DESC') |
|
126 | reply = Message.find(:first, :order => 'id DESC') | |
127 | assert_redirected_to "boards/1/topics/1?r=#{reply.id}" |
|
127 | assert_redirected_to "/boards/1/topics/1?r=#{reply.id}" | |
128 | assert Message.find_by_subject('Test reply') |
|
128 | assert Message.find_by_subject('Test reply') | |
129 | end |
|
129 | end | |
130 |
|
130 | |||
131 | def test_destroy_topic |
|
131 | def test_destroy_topic | |
132 | @request.session[:user_id] = 2 |
|
132 | @request.session[:user_id] = 2 | |
133 | post :destroy, :board_id => 1, :id => 1 |
|
133 | post :destroy, :board_id => 1, :id => 1 | |
134 | assert_redirected_to 'projects/ecookbook/boards/1' |
|
134 | assert_redirected_to '/projects/ecookbook/boards/1' | |
135 | assert_nil Message.find_by_id(1) |
|
135 | assert_nil Message.find_by_id(1) | |
136 | end |
|
136 | end | |
137 |
|
137 |
@@ -68,7 +68,7 class MyControllerTest < ActionController::TestCase | |||||
68 | :login => "root", |
|
68 | :login => "root", | |
69 | :admin => 1, |
|
69 | :admin => 1, | |
70 | :custom_field_values => {"4" => "0100562500"}} |
|
70 | :custom_field_values => {"4" => "0100562500"}} | |
71 | assert_redirected_to 'my/account' |
|
71 | assert_redirected_to '/my/account' | |
72 | user = User.find(2) |
|
72 | user = User.find(2) | |
73 | assert_equal user, assigns(:user) |
|
73 | assert_equal user, assigns(:user) | |
74 | assert_equal "Joe", user.firstname |
|
74 | assert_equal "Joe", user.firstname | |
@@ -102,7 +102,7 class MyControllerTest < ActionController::TestCase | |||||
102 | post :password, :password => 'jsmith', |
|
102 | post :password, :password => 'jsmith', | |
103 | :new_password => 'hello', |
|
103 | :new_password => 'hello', | |
104 | :new_password_confirmation => 'hello' |
|
104 | :new_password_confirmation => 'hello' | |
105 | assert_redirected_to 'my/account' |
|
105 | assert_redirected_to '/my/account' | |
106 | assert User.try_to_login('jsmith', 'hello') |
|
106 | assert User.try_to_login('jsmith', 'hello') | |
107 | end |
|
107 | end | |
108 |
|
108 |
@@ -73,7 +73,7 class NewsControllerTest < ActionController::TestCase | |||||
73 | post :create, :project_id => 1, :news => { :title => 'NewsControllerTest', |
|
73 | post :create, :project_id => 1, :news => { :title => 'NewsControllerTest', | |
74 | :description => 'This is the description', |
|
74 | :description => 'This is the description', | |
75 | :summary => '' } |
|
75 | :summary => '' } | |
76 | assert_redirected_to 'projects/ecookbook/news' |
|
76 | assert_redirected_to '/projects/ecookbook/news' | |
77 |
|
77 | |||
78 | news = News.find_by_title('NewsControllerTest') |
|
78 | news = News.find_by_title('NewsControllerTest') | |
79 | assert_not_nil news |
|
79 | assert_not_nil news | |
@@ -93,7 +93,7 class NewsControllerTest < ActionController::TestCase | |||||
93 | def test_put_update |
|
93 | def test_put_update | |
94 | @request.session[:user_id] = 2 |
|
94 | @request.session[:user_id] = 2 | |
95 | put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' } |
|
95 | put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' } | |
96 | assert_redirected_to 'news/1' |
|
96 | assert_redirected_to '/news/1' | |
97 | news = News.find(1) |
|
97 | news = News.find(1) | |
98 | assert_equal 'Description changed by test_post_edit', news.description |
|
98 | assert_equal 'Description changed by test_post_edit', news.description | |
99 | end |
|
99 | end | |
@@ -114,7 +114,7 class NewsControllerTest < ActionController::TestCase | |||||
114 | def test_destroy |
|
114 | def test_destroy | |
115 | @request.session[:user_id] = 2 |
|
115 | @request.session[:user_id] = 2 | |
116 | delete :destroy, :id => 1 |
|
116 | delete :destroy, :id => 1 | |
117 | assert_redirected_to 'projects/ecookbook/news' |
|
117 | assert_redirected_to '/projects/ecookbook/news' | |
118 | assert_nil News.find_by_id(1) |
|
118 | assert_nil News.find_by_id(1) | |
119 | end |
|
119 | end | |
120 | end |
|
120 | end |
@@ -20,7 +20,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||||
20 | } |
|
20 | } | |
21 |
|
21 | |||
22 | assert_response :redirect |
|
22 | assert_response :redirect | |
23 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
23 | assert_redirected_to '/projects/ecookbook/settings/activities' | |
24 |
|
24 | |||
25 | # Created project specific activities... |
|
25 | # Created project specific activities... | |
26 | project = Project.find('ecookbook') |
|
26 | project = Project.find('ecookbook') | |
@@ -83,7 +83,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||||
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 | assert_response :redirect |
|
85 | assert_response :redirect | |
86 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
86 | assert_redirected_to '/projects/ecookbook/settings/activities' | |
87 |
|
87 | |||
88 | # Created project specific activities... |
|
88 | # Created project specific activities... | |
89 | project = Project.find('ecookbook') |
|
89 | project = Project.find('ecookbook') | |
@@ -159,7 +159,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||||
159 |
|
159 | |||
160 | delete :destroy, :project_id => 1 |
|
160 | delete :destroy, :project_id => 1 | |
161 | assert_response :redirect |
|
161 | assert_response :redirect | |
162 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
162 | assert_redirected_to '/projects/ecookbook/settings/activities' | |
163 |
|
163 | |||
164 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) |
|
164 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) | |
165 | assert_nil TimeEntryActivity.find_by_id(project_activity_two.id) |
|
165 | assert_nil TimeEntryActivity.find_by_id(project_activity_two.id) | |
@@ -179,7 +179,7 class ProjectEnumerationsControllerTest < ActionController::TestCase | |||||
179 |
|
179 | |||
180 | delete :destroy, :project_id => 1 |
|
180 | delete :destroy, :project_id => 1 | |
181 | assert_response :redirect |
|
181 | assert_response :redirect | |
182 | assert_redirected_to 'projects/ecookbook/settings/activities' |
|
182 | assert_redirected_to '/projects/ecookbook/settings/activities' | |
183 |
|
183 | |||
184 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) |
|
184 | assert_nil TimeEntryActivity.find_by_id(project_activity.id) | |
185 | assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size, "TimeEntries still assigned to project specific activity" |
|
185 | assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size, "TimeEntries still assigned to project specific activity" |
@@ -344,7 +344,7 class ProjectsControllerTest < ActionController::TestCase | |||||
344 | @request.session[:user_id] = 2 # manager |
|
344 | @request.session[:user_id] = 2 # manager | |
345 | post :update, :id => 1, :project => {:name => 'Test changed name', |
|
345 | post :update, :id => 1, :project => {:name => 'Test changed name', | |
346 | :issue_custom_field_ids => ['']} |
|
346 | :issue_custom_field_ids => ['']} | |
347 | assert_redirected_to 'projects/ecookbook/settings' |
|
347 | assert_redirected_to '/projects/ecookbook/settings' | |
348 | project = Project.find(1) |
|
348 | project = Project.find(1) | |
349 | assert_equal 'Test changed name', project.name |
|
349 | assert_equal 'Test changed name', project.name | |
350 | end |
|
350 | end | |
@@ -360,14 +360,14 class ProjectsControllerTest < ActionController::TestCase | |||||
360 | def test_post_destroy |
|
360 | def test_post_destroy | |
361 | @request.session[:user_id] = 1 # admin |
|
361 | @request.session[:user_id] = 1 # admin | |
362 | post :destroy, :id => 1, :confirm => 1 |
|
362 | post :destroy, :id => 1, :confirm => 1 | |
363 | assert_redirected_to 'admin/projects' |
|
363 | assert_redirected_to '/admin/projects' | |
364 | assert_nil Project.find_by_id(1) |
|
364 | assert_nil Project.find_by_id(1) | |
365 | end |
|
365 | end | |
366 |
|
366 | |||
367 | def test_archive |
|
367 | def test_archive | |
368 | @request.session[:user_id] = 1 # admin |
|
368 | @request.session[:user_id] = 1 # admin | |
369 | post :archive, :id => 1 |
|
369 | post :archive, :id => 1 | |
370 | assert_redirected_to 'admin/projects' |
|
370 | assert_redirected_to '/admin/projects' | |
371 | assert !Project.find(1).active? |
|
371 | assert !Project.find(1).active? | |
372 | end |
|
372 | end | |
373 |
|
373 | |||
@@ -375,7 +375,7 class ProjectsControllerTest < ActionController::TestCase | |||||
375 | @request.session[:user_id] = 1 # admin |
|
375 | @request.session[:user_id] = 1 # admin | |
376 | Project.find(1).archive |
|
376 | Project.find(1).archive | |
377 | post :unarchive, :id => 1 |
|
377 | post :unarchive, :id => 1 | |
378 | assert_redirected_to 'admin/projects' |
|
378 | assert_redirected_to '/admin/projects' | |
379 | assert Project.find(1).active? |
|
379 | assert Project.find(1).active? | |
380 | end |
|
380 | end | |
381 |
|
381 | |||
@@ -424,7 +424,7 class ProjectsControllerTest < ActionController::TestCase | |||||
424 |
|
424 | |||
425 | def test_jump_should_redirect_to_active_tab |
|
425 | def test_jump_should_redirect_to_active_tab | |
426 | get :show, :id => 1, :jump => 'issues' |
|
426 | get :show, :id => 1, :jump => 'issues' | |
427 | assert_redirected_to 'projects/ecookbook/issues' |
|
427 | assert_redirected_to '/projects/ecookbook/issues' | |
428 | end |
|
428 | end | |
429 |
|
429 | |||
430 | def test_jump_should_not_redirect_to_inactive_tab |
|
430 | def test_jump_should_not_redirect_to_inactive_tab |
@@ -98,7 +98,7 class RepositoriesControllerTest < ActionController::TestCase | |||||
98 |
|
98 | |||
99 | assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do |
|
99 | assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do | |
100 | post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']} |
|
100 | post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']} | |
101 | assert_redirected_to 'projects/ecookbook/repository/committers' |
|
101 | assert_redirected_to '/projects/ecookbook/repository/committers' | |
102 | assert_equal User.find(2), c.reload.user |
|
102 | assert_equal User.find(2), c.reload.user | |
103 | end |
|
103 | end | |
104 | end |
|
104 | end |
@@ -65,7 +65,7 class RolesControllerTest < ActionController::TestCase | |||||
65 | :permissions => ['add_issues', 'edit_issues', 'log_time', ''], |
|
65 | :permissions => ['add_issues', 'edit_issues', 'log_time', ''], | |
66 | :assignable => '0'} |
|
66 | :assignable => '0'} | |
67 |
|
67 | |||
68 | assert_redirected_to 'roles' |
|
68 | assert_redirected_to '/roles' | |
69 | role = Role.find_by_name('RoleWithoutWorkflowCopy') |
|
69 | role = Role.find_by_name('RoleWithoutWorkflowCopy') | |
70 | assert_not_nil role |
|
70 | assert_not_nil role | |
71 | assert_equal [:add_issues, :edit_issues, :log_time], role.permissions |
|
71 | assert_equal [:add_issues, :edit_issues, :log_time], role.permissions | |
@@ -78,7 +78,7 class RolesControllerTest < ActionController::TestCase | |||||
78 | :assignable => '0'}, |
|
78 | :assignable => '0'}, | |
79 | :copy_workflow_from => '1' |
|
79 | :copy_workflow_from => '1' | |
80 |
|
80 | |||
81 | assert_redirected_to 'roles' |
|
81 | assert_redirected_to '/roles' | |
82 | role = Role.find_by_name('RoleWithWorkflowCopy') |
|
82 | role = Role.find_by_name('RoleWithWorkflowCopy') | |
83 | assert_not_nil role |
|
83 | assert_not_nil role | |
84 | assert_equal Role.find(1).workflows.size, role.workflows.size |
|
84 | assert_equal Role.find(1).workflows.size, role.workflows.size | |
@@ -97,7 +97,7 class RolesControllerTest < ActionController::TestCase | |||||
97 | :permissions => ['edit_project', ''], |
|
97 | :permissions => ['edit_project', ''], | |
98 | :assignable => '0'} |
|
98 | :assignable => '0'} | |
99 |
|
99 | |||
100 | assert_redirected_to 'roles' |
|
100 | assert_redirected_to '/roles' | |
101 | role = Role.find(1) |
|
101 | role = Role.find(1) | |
102 | assert_equal [:edit_project], role.permissions |
|
102 | assert_equal [:edit_project], role.permissions | |
103 | end |
|
103 | end | |
@@ -107,13 +107,13 class RolesControllerTest < ActionController::TestCase | |||||
107 | assert r.save |
|
107 | assert r.save | |
108 |
|
108 | |||
109 | post :destroy, :id => r |
|
109 | post :destroy, :id => r | |
110 | assert_redirected_to 'roles' |
|
110 | assert_redirected_to '/roles' | |
111 | assert_nil Role.find_by_id(r.id) |
|
111 | assert_nil Role.find_by_id(r.id) | |
112 | end |
|
112 | end | |
113 |
|
113 | |||
114 | def test_destroy_role_in_use |
|
114 | def test_destroy_role_in_use | |
115 | post :destroy, :id => 1 |
|
115 | post :destroy, :id => 1 | |
116 | assert_redirected_to 'roles' |
|
116 | assert_redirected_to '/roles' | |
117 | assert flash[:error] == 'This role is in use and can not be deleted.' |
|
117 | assert flash[:error] == 'This role is in use and can not be deleted.' | |
118 | assert_not_nil Role.find_by_id(1) |
|
118 | assert_not_nil Role.find_by_id(1) | |
119 | end |
|
119 | end | |
@@ -139,7 +139,7 class RolesControllerTest < ActionController::TestCase | |||||
139 |
|
139 | |||
140 | def test_post_report |
|
140 | def test_post_report | |
141 | post :report, :permissions => { '0' => '', '1' => ['edit_issues'], '3' => ['add_issues', 'delete_issues']} |
|
141 | post :report, :permissions => { '0' => '', '1' => ['edit_issues'], '3' => ['add_issues', 'delete_issues']} | |
142 | assert_redirected_to 'roles' |
|
142 | assert_redirected_to '/roles' | |
143 |
|
143 | |||
144 | assert_equal [:edit_issues], Role.find(1).permissions |
|
144 | assert_equal [:edit_issues], Role.find(1).permissions | |
145 | assert_equal [:add_issues, :delete_issues], Role.find(3).permissions |
|
145 | assert_equal [:add_issues, :delete_issues], Role.find(3).permissions | |
@@ -148,33 +148,33 class RolesControllerTest < ActionController::TestCase | |||||
148 |
|
148 | |||
149 | def test_clear_all_permissions |
|
149 | def test_clear_all_permissions | |
150 | post :report, :permissions => { '0' => '' } |
|
150 | post :report, :permissions => { '0' => '' } | |
151 | assert_redirected_to 'roles' |
|
151 | assert_redirected_to '/roles' | |
152 | assert Role.find(1).permissions.empty? |
|
152 | assert Role.find(1).permissions.empty? | |
153 | end |
|
153 | end | |
154 |
|
154 | |||
155 | def test_move_highest |
|
155 | def test_move_highest | |
156 | post :edit, :id => 3, :role => {:move_to => 'highest'} |
|
156 | post :edit, :id => 3, :role => {:move_to => 'highest'} | |
157 | assert_redirected_to 'roles' |
|
157 | assert_redirected_to '/roles' | |
158 | assert_equal 1, Role.find(3).position |
|
158 | assert_equal 1, Role.find(3).position | |
159 | end |
|
159 | end | |
160 |
|
160 | |||
161 | def test_move_higher |
|
161 | def test_move_higher | |
162 | position = Role.find(3).position |
|
162 | position = Role.find(3).position | |
163 | post :edit, :id => 3, :role => {:move_to => 'higher'} |
|
163 | post :edit, :id => 3, :role => {:move_to => 'higher'} | |
164 | assert_redirected_to 'roles' |
|
164 | assert_redirected_to '/roles' | |
165 | assert_equal position - 1, Role.find(3).position |
|
165 | assert_equal position - 1, Role.find(3).position | |
166 | end |
|
166 | end | |
167 |
|
167 | |||
168 | def test_move_lower |
|
168 | def test_move_lower | |
169 | position = Role.find(2).position |
|
169 | position = Role.find(2).position | |
170 | post :edit, :id => 2, :role => {:move_to => 'lower'} |
|
170 | post :edit, :id => 2, :role => {:move_to => 'lower'} | |
171 | assert_redirected_to 'roles' |
|
171 | assert_redirected_to '/roles' | |
172 | assert_equal position + 1, Role.find(2).position |
|
172 | assert_equal position + 1, Role.find(2).position | |
173 | end |
|
173 | end | |
174 |
|
174 | |||
175 | def test_move_lowest |
|
175 | def test_move_lowest | |
176 | post :edit, :id => 2, :role => {:move_to => 'lowest'} |
|
176 | post :edit, :id => 2, :role => {:move_to => 'lowest'} | |
177 | assert_redirected_to 'roles' |
|
177 | assert_redirected_to '/roles' | |
178 | assert_equal Role.count, Role.find(2).position |
|
178 | assert_equal Role.count, Role.find(2).position | |
179 | end |
|
179 | end | |
180 | end |
|
180 | end |
@@ -126,7 +126,7 class SearchControllerTest < ActionController::TestCase | |||||
126 | def test_quick_jump_to_issue |
|
126 | def test_quick_jump_to_issue | |
127 | # issue of a public project |
|
127 | # issue of a public project | |
128 | get :index, :q => "3" |
|
128 | get :index, :q => "3" | |
129 | assert_redirected_to 'issues/3' |
|
129 | assert_redirected_to '/issues/3' | |
130 |
|
130 | |||
131 | # issue of a private project |
|
131 | # issue of a private project | |
132 | get :index, :q => "4" |
|
132 | get :index, :q => "4" |
@@ -50,7 +50,7 class SettingsControllerTest < ActionController::TestCase | |||||
50 | :notified_events => %w(issue_added issue_updated news_added), |
|
50 | :notified_events => %w(issue_added issue_updated news_added), | |
51 | :emails_footer => 'Test footer' |
|
51 | :emails_footer => 'Test footer' | |
52 | } |
|
52 | } | |
53 | assert_redirected_to 'settings/edit' |
|
53 | assert_redirected_to '/settings/edit' | |
54 | assert_equal 'functional@test.foo', Setting.mail_from |
|
54 | assert_equal 'functional@test.foo', Setting.mail_from | |
55 | assert !Setting.bcc_recipients? |
|
55 | assert !Setting.bcc_recipients? | |
56 | assert_equal %w(issue_added issue_updated news_added), Setting.notified_events |
|
56 | assert_equal %w(issue_added issue_updated news_added), Setting.notified_events |
@@ -44,7 +44,7 class AccountTest < ActionController::IntegrationTest | |||||
44 |
|
44 | |||
45 | # User logs in with 'autologin' checked |
|
45 | # User logs in with 'autologin' checked | |
46 | post '/login', :username => user.login, :password => 'admin', :autologin => 1 |
|
46 | post '/login', :username => user.login, :password => 'admin', :autologin => 1 | |
47 | assert_redirected_to 'my/page' |
|
47 | assert_redirected_to '/my/page' | |
48 | token = Token.find :first |
|
48 | token = Token.find :first | |
49 | assert_not_nil token |
|
49 | assert_not_nil token | |
50 | assert_equal user, token.user |
|
50 | assert_equal user, token.user | |
@@ -105,7 +105,7 class AccountTest < ActionController::IntegrationTest | |||||
105 |
|
105 | |||
106 | post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, |
|
106 | post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, | |
107 | :password => "newpass", :password_confirmation => "newpass" |
|
107 | :password => "newpass", :password_confirmation => "newpass" | |
108 | assert_redirected_to 'my/account' |
|
108 | assert_redirected_to '/my/account' | |
109 | follow_redirect! |
|
109 | follow_redirect! | |
110 | assert_response :success |
|
110 | assert_response :success | |
111 | assert_template 'my/account' |
|
111 | assert_template 'my/account' | |
@@ -152,7 +152,7 class AccountTest < ActionController::IntegrationTest | |||||
152 | AuthSource.expects(:authenticate).returns({:login => 'foo', :firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com', :auth_source_id => 66}) |
|
152 | AuthSource.expects(:authenticate).returns({:login => 'foo', :firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com', :auth_source_id => 66}) | |
153 |
|
153 | |||
154 | post 'account/login', :username => 'foo', :password => 'bar' |
|
154 | post 'account/login', :username => 'foo', :password => 'bar' | |
155 | assert_redirected_to 'my/page' |
|
155 | assert_redirected_to '/my/page' | |
156 |
|
156 | |||
157 | user = User.find_by_login('foo') |
|
157 | user = User.find_by_login('foo') | |
158 | assert user.is_a?(User) |
|
158 | assert user.is_a?(User) | |
@@ -187,7 +187,7 class AccountTest < ActionController::IntegrationTest | |||||
187 | sid = session[:session_id] |
|
187 | sid = session[:session_id] | |
188 |
|
188 | |||
189 | post '/login', :username => 'admin', :password => 'admin' |
|
189 | post '/login', :username => 'admin', :password => 'admin' | |
190 | assert_redirected_to 'my/page' |
|
190 | assert_redirected_to '/my/page' | |
191 | assert_not_equal sid, session[:session_id], "login should reset session" |
|
191 | assert_not_equal sid, session[:session_id], "login should reset session" | |
192 | assert_equal 1, session[:user_id] |
|
192 | assert_equal 1, session[:user_id] | |
193 | sid = session[:session_id] |
|
193 | sid = session[:session_id] |
@@ -72,7 +72,7 class IssuesTest < ActionController::IntegrationTest | |||||
72 | put 'issues/1', |
|
72 | put 'issues/1', | |
73 | :notes => 'Some notes', |
|
73 | :notes => 'Some notes', | |
74 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}} |
|
74 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}} | |
75 | assert_redirected_to "issues/1" |
|
75 | assert_redirected_to "/issues/1" | |
76 |
|
76 | |||
77 | # make sure attachment was saved |
|
77 | # make sure attachment was saved | |
78 | attachment = Issue.find(1).attachments.find_by_filename("testfile.txt") |
|
78 | attachment = Issue.find(1).attachments.find_by_filename("testfile.txt") |
@@ -27,7 +27,7 class ProjectsTest < ActionController::IntegrationTest | |||||
27 | assert_response :success |
|
27 | assert_response :success | |
28 | assert_template "admin/projects" |
|
28 | assert_template "admin/projects" | |
29 | post "projects/archive", :id => 1 |
|
29 | post "projects/archive", :id => 1 | |
30 | assert_redirected_to "admin/projects" |
|
30 | assert_redirected_to "/admin/projects" | |
31 | assert !Project.find(1).active? |
|
31 | assert !Project.find(1).active? | |
32 |
|
32 | |||
33 | get 'projects/1' |
|
33 | get 'projects/1' | |
@@ -36,7 +36,7 class ProjectsTest < ActionController::IntegrationTest | |||||
36 | assert_response 403 |
|
36 | assert_response 403 | |
37 |
|
37 | |||
38 | post "projects/unarchive", :id => 1 |
|
38 | post "projects/unarchive", :id => 1 | |
39 | assert_redirected_to "admin/projects" |
|
39 | assert_redirected_to "/admin/projects" | |
40 | assert Project.find(1).active? |
|
40 | assert Project.find(1).active? | |
41 | get "projects/1" |
|
41 | get "projects/1" | |
42 | assert_response :success |
|
42 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now