@@ -76,14 +76,8 class ReportsController < ApplicationController | |||||
76 | @rows = @project.descendants.visible |
|
76 | @rows = @project.descendants.visible | |
77 | @data = Issue.by_subproject(@project) || [] |
|
77 | @data = Issue.by_subproject(@project) || [] | |
78 | @report_title = l(:field_subproject) |
|
78 | @report_title = l(:field_subproject) | |
79 |
e |
|
79 | else | |
80 |
|
80 | render_404 | ||
81 | respond_to do |format| |
|
|||
82 | if @field |
|
|||
83 | format.html {} |
|
|||
84 | else |
|
|||
85 | format.html { redirect_to :action => 'issue_report', :id => @project } |
|
|||
86 | end |
|
|||
87 | end |
|
81 | end | |
88 | end |
|
82 | end | |
89 |
|
83 |
@@ -27,10 +27,8 class MessagesControllerTest < Redmine::ControllerTest | |||||
27 | def test_show |
|
27 | def test_show | |
28 | get :show, :board_id => 1, :id => 1 |
|
28 | get :show, :board_id => 1, :id => 1 | |
29 | assert_response :success |
|
29 | assert_response :success | |
30 | assert_template 'show' |
|
30 | ||
31 | assert_not_nil assigns(:board) |
|
31 | assert_select 'h2', :text => 'First post' | |
32 | assert_not_nil assigns(:project) |
|
|||
33 | assert_not_nil assigns(:topic) |
|
|||
34 | end |
|
32 | end | |
35 |
|
33 | |||
36 | def test_show_should_contain_reply_field_tags_for_quoting |
|
34 | def test_show_should_contain_reply_field_tags_for_quoting | |
@@ -54,20 +52,20 class MessagesControllerTest < Redmine::ControllerTest | |||||
54 | :board_id => 1) |
|
52 | :board_id => 1) | |
55 | end |
|
53 | end | |
56 | end |
|
54 | end | |
57 | get :show, :board_id => 1, :id => 1, :r => message.children.order('id').last.id |
|
55 | reply_ids = message.children.map(&:id).sort | |
|
56 | ||||
|
57 | get :show, :board_id => 1, :id => 1, :r => reply_ids.last | |||
58 | assert_response :success |
|
58 | assert_response :success | |
59 | assert_template 'show' |
|
59 | ||
60 | replies = assigns(:replies) |
|
60 | assert_select 'a[href=?]', "/boards/1/topics/1?r=#{reply_ids.last}#message-#{reply_ids.last}" | |
61 | assert_not_nil replies |
|
61 | assert_select 'a[href=?]', "/boards/1/topics/1?r=#{reply_ids.first}#message-#{reply_ids.first}", 0 | |
62 | assert_not_include message.children.reorder('id').first, replies |
|
|||
63 | assert_include message.children.reorder('id').last, replies |
|
|||
64 | end |
|
62 | end | |
65 |
|
63 | |||
66 | def test_show_with_reply_permission |
|
64 | def test_show_with_reply_permission | |
67 | @request.session[:user_id] = 2 |
|
65 | @request.session[:user_id] = 2 | |
68 | get :show, :board_id => 1, :id => 1 |
|
66 | get :show, :board_id => 1, :id => 1 | |
69 | assert_response :success |
|
67 | assert_response :success | |
70 | assert_template 'show' |
|
68 | ||
71 | assert_select 'div#reply textarea#message_content' |
|
69 | assert_select 'div#reply textarea#message_content' | |
72 | end |
|
70 | end | |
73 |
|
71 | |||
@@ -85,7 +83,8 class MessagesControllerTest < Redmine::ControllerTest | |||||
85 | @request.session[:user_id] = 2 |
|
83 | @request.session[:user_id] = 2 | |
86 | get :new, :board_id => 1 |
|
84 | get :new, :board_id => 1 | |
87 | assert_response :success |
|
85 | assert_response :success | |
88 | assert_template 'new' |
|
86 | ||
|
87 | assert_select 'input[name=?]', 'message[subject]' | |||
89 | end |
|
88 | end | |
90 |
|
89 | |||
91 | def test_get_new_with_invalid_board |
|
90 | def test_get_new_with_invalid_board | |
@@ -124,7 +123,8 class MessagesControllerTest < Redmine::ControllerTest | |||||
124 | @request.session[:user_id] = 2 |
|
123 | @request.session[:user_id] = 2 | |
125 | get :edit, :board_id => 1, :id => 1 |
|
124 | get :edit, :board_id => 1, :id => 1 | |
126 | assert_response :success |
|
125 | assert_response :success | |
127 | assert_template 'edit' |
|
126 | ||
|
127 | assert_select 'input[name=?][value=?]', 'message[subject]', 'First post' | |||
128 | end |
|
128 | end | |
129 |
|
129 | |||
130 | def test_post_edit |
|
130 | def test_post_edit | |
@@ -193,7 +193,7 class MessagesControllerTest < Redmine::ControllerTest | |||||
193 | xhr :get, :quote, :board_id => 1, :id => 3 |
|
193 | xhr :get, :quote, :board_id => 1, :id => 3 | |
194 | assert_response :success |
|
194 | assert_response :success | |
195 | assert_equal 'text/javascript', response.content_type |
|
195 | assert_equal 'text/javascript', response.content_type | |
196 | assert_template 'quote' |
|
196 | ||
197 | assert_include 'RE: First post', response.body |
|
197 | assert_include 'RE: First post', response.body | |
198 | assert_include '> An other reply', response.body |
|
198 | assert_include '> An other reply', response.body | |
199 | end |
|
199 | end | |
@@ -204,7 +204,7 class MessagesControllerTest < Redmine::ControllerTest | |||||
204 | :board_id => 1, |
|
204 | :board_id => 1, | |
205 | :message => {:subject => "", :content => "Previewed text"} |
|
205 | :message => {:subject => "", :content => "Previewed text"} | |
206 | assert_response :success |
|
206 | assert_response :success | |
207 | assert_template 'common/_preview' |
|
207 | assert_include 'Previewed text', response.body | |
208 | end |
|
208 | end | |
209 |
|
209 | |||
210 | def test_preview_edit |
|
210 | def test_preview_edit | |
@@ -214,6 +214,6 class MessagesControllerTest < Redmine::ControllerTest | |||||
214 | :board_id => 1, |
|
214 | :board_id => 1, | |
215 | :message => {:subject => "", :content => "Previewed text"} |
|
215 | :message => {:subject => "", :content => "Previewed text"} | |
216 | assert_response :success |
|
216 | assert_response :success | |
217 | assert_template 'common/_preview' |
|
217 | assert_include 'Previewed text', response.body | |
218 | end |
|
218 | end | |
219 | end |
|
219 | end |
@@ -28,13 +28,13 class MyControllerTest < Redmine::ControllerTest | |||||
28 | def test_index |
|
28 | def test_index | |
29 | get :index |
|
29 | get :index | |
30 | assert_response :success |
|
30 | assert_response :success | |
31 |
assert_ |
|
31 | assert_select 'h2', 'My page' | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def test_page |
|
34 | def test_page | |
35 | get :page |
|
35 | get :page | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 |
assert_ |
|
37 | assert_select 'h2', 'My page' | |
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | def test_page_with_timelog_block |
|
40 | def test_page_with_timelog_block | |
@@ -65,9 +65,6 class MyControllerTest < Redmine::ControllerTest | |||||
65 | def test_my_account_should_show_editable_custom_fields |
|
65 | def test_my_account_should_show_editable_custom_fields | |
66 | get :account |
|
66 | get :account | |
67 | assert_response :success |
|
67 | assert_response :success | |
68 | assert_template 'account' |
|
|||
69 | assert_equal User.find(2), assigns(:user) |
|
|||
70 |
|
||||
71 | assert_select 'input[name=?]', 'user[custom_field_values][4]' |
|
68 | assert_select 'input[name=?]', 'user[custom_field_values][4]' | |
72 | end |
|
69 | end | |
73 |
|
70 | |||
@@ -76,9 +73,6 class MyControllerTest < Redmine::ControllerTest | |||||
76 |
|
73 | |||
77 | get :account |
|
74 | get :account | |
78 | assert_response :success |
|
75 | assert_response :success | |
79 | assert_template 'account' |
|
|||
80 | assert_equal User.find(2), assigns(:user) |
|
|||
81 |
|
||||
82 | assert_select 'input[name=?]', 'user[custom_field_values][4]', 0 |
|
76 | assert_select 'input[name=?]', 'user[custom_field_values][4]', 0 | |
83 | end |
|
77 | end | |
84 |
|
78 | |||
@@ -108,7 +102,6 class MyControllerTest < Redmine::ControllerTest | |||||
108 |
|
102 | |||
109 | assert_redirected_to '/my/account' |
|
103 | assert_redirected_to '/my/account' | |
110 | user = User.find(2) |
|
104 | user = User.find(2) | |
111 | assert_equal user, assigns(:user) |
|
|||
112 | assert_equal "Joe", user.firstname |
|
105 | assert_equal "Joe", user.firstname | |
113 | assert_equal "jsmith", user.login |
|
106 | assert_equal "jsmith", user.login | |
114 | assert_equal "0100562500", user.custom_value_for(4).value |
|
107 | assert_equal "0100562500", user.custom_value_for(4).value | |
@@ -143,7 +136,6 class MyControllerTest < Redmine::ControllerTest | |||||
143 | def test_get_destroy_should_display_the_destroy_confirmation |
|
136 | def test_get_destroy_should_display_the_destroy_confirmation | |
144 | get :destroy |
|
137 | get :destroy | |
145 | assert_response :success |
|
138 | assert_response :success | |
146 | assert_template 'destroy' |
|
|||
147 | assert_select 'form[action="/my/account/destroy"]' do |
|
139 | assert_select 'form[action="/my/account/destroy"]' do | |
148 | assert_select 'input[name=confirm]' |
|
140 | assert_select 'input[name=confirm]' | |
149 | end |
|
141 | end | |
@@ -154,7 +146,6 class MyControllerTest < Redmine::ControllerTest | |||||
154 | post :destroy |
|
146 | post :destroy | |
155 | end |
|
147 | end | |
156 | assert_response :success |
|
148 | assert_response :success | |
157 | assert_template 'destroy' |
|
|||
158 | end |
|
149 | end | |
159 |
|
150 | |||
160 | def test_post_destroy_without_confirmation_should_destroy_account |
|
151 | def test_post_destroy_without_confirmation_should_destroy_account | |
@@ -177,30 +168,36 class MyControllerTest < Redmine::ControllerTest | |||||
177 | def test_change_password |
|
168 | def test_change_password | |
178 | get :password |
|
169 | get :password | |
179 | assert_response :success |
|
170 | assert_response :success | |
180 | assert_template 'password' |
|
171 | assert_select 'input[type=password][name=password]' | |
|
172 | assert_select 'input[type=password][name=new_password]' | |||
|
173 | assert_select 'input[type=password][name=new_password_confirmation]' | |||
|
174 | end | |||
181 |
|
175 | |||
182 | # non matching password confirmation |
|
176 | def test_update_password | |
|
177 | post :password, :password => 'jsmith', | |||
|
178 | :new_password => 'secret123', | |||
|
179 | :new_password_confirmation => 'secret123' | |||
|
180 | assert_redirected_to '/my/account' | |||
|
181 | assert User.try_to_login('jsmith', 'secret123') | |||
|
182 | end | |||
|
183 | ||||
|
184 | def test_update_password_with_non_matching_confirmation | |||
183 | post :password, :password => 'jsmith', |
|
185 | post :password, :password => 'jsmith', | |
184 | :new_password => 'secret123', |
|
186 | :new_password => 'secret123', | |
185 | :new_password_confirmation => 'secret1234' |
|
187 | :new_password_confirmation => 'secret1234' | |
186 | assert_response :success |
|
188 | assert_response :success | |
187 | assert_template 'password' |
|
|||
188 | assert_select_error /Password doesn.*t match confirmation/ |
|
189 | assert_select_error /Password doesn.*t match confirmation/ | |
|
190 | assert User.try_to_login('jsmith', 'jsmith') | |||
|
191 | end | |||
189 |
|
192 | |||
|
193 | def test_update_password_with_wrong_password | |||
190 | # wrong password |
|
194 | # wrong password | |
191 | post :password, :password => 'wrongpassword', |
|
195 | post :password, :password => 'wrongpassword', | |
192 | :new_password => 'secret123', |
|
196 | :new_password => 'secret123', | |
193 | :new_password_confirmation => 'secret123' |
|
197 | :new_password_confirmation => 'secret123' | |
194 | assert_response :success |
|
198 | assert_response :success | |
195 | assert_template 'password' |
|
|||
196 | assert_equal 'Wrong password', flash[:error] |
|
199 | assert_equal 'Wrong password', flash[:error] | |
197 |
|
200 | assert User.try_to_login('jsmith', 'jsmith') | ||
198 | # good password |
|
|||
199 | post :password, :password => 'jsmith', |
|
|||
200 | :new_password => 'secret123', |
|
|||
201 | :new_password_confirmation => 'secret123' |
|
|||
202 | assert_redirected_to '/my/account' |
|
|||
203 | assert User.try_to_login('jsmith', 'secret123') |
|
|||
204 | end |
|
201 | end | |
205 |
|
202 | |||
206 | def test_change_password_should_redirect_if_user_cannot_change_its_password |
|
203 | def test_change_password_should_redirect_if_user_cannot_change_its_password | |
@@ -211,7 +208,7 class MyControllerTest < Redmine::ControllerTest | |||||
211 | assert_redirected_to '/my/account' |
|
208 | assert_redirected_to '/my/account' | |
212 | end |
|
209 | end | |
213 |
|
210 | |||
214 |
def test_ |
|
211 | def test_update_password_should_send_security_notification | |
215 | ActionMailer::Base.deliveries.clear |
|
212 | ActionMailer::Base.deliveries.clear | |
216 | post :password, :password => 'jsmith', |
|
213 | post :password, :password => 'jsmith', | |
217 | :new_password => 'secret123', |
|
214 | :new_password => 'secret123', | |
@@ -227,7 +224,6 class MyControllerTest < Redmine::ControllerTest | |||||
227 | def test_page_layout |
|
224 | def test_page_layout | |
228 | get :page_layout |
|
225 | get :page_layout | |
229 | assert_response :success |
|
226 | assert_response :success | |
230 | assert_template 'page_layout' |
|
|||
231 | end |
|
227 | end | |
232 |
|
228 | |||
233 | def test_add_block |
|
229 | def test_add_block |
@@ -29,16 +29,13 class NewsControllerTest < Redmine::ControllerTest | |||||
29 | def test_index |
|
29 | def test_index | |
30 | get :index |
|
30 | get :index | |
31 | assert_response :success |
|
31 | assert_response :success | |
32 | assert_template 'index' |
|
32 | assert_select 'h3 a', :text => 'eCookbook first release !' | |
33 | assert_not_nil assigns(:newss) |
|
|||
34 | assert_nil assigns(:project) |
|
|||
35 | end |
|
33 | end | |
36 |
|
34 | |||
37 | def test_index_with_project |
|
35 | def test_index_with_project | |
38 | get :index, :project_id => 1 |
|
36 | get :index, :project_id => 1 | |
39 | assert_response :success |
|
37 | assert_response :success | |
40 | assert_template 'index' |
|
38 | assert_select 'h3 a', :text => 'eCookbook first release !' | |
41 | assert_not_nil assigns(:newss) |
|
|||
42 | end |
|
39 | end | |
43 |
|
40 | |||
44 | def test_index_with_invalid_project_should_respond_with_404 |
|
41 | def test_index_with_invalid_project_should_respond_with_404 | |
@@ -49,8 +46,7 class NewsControllerTest < Redmine::ControllerTest | |||||
49 | def test_show |
|
46 | def test_show | |
50 | get :show, :id => 1 |
|
47 | get :show, :id => 1 | |
51 | assert_response :success |
|
48 | assert_response :success | |
52 | assert_template 'show' |
|
49 | assert_select 'h2', :text => 'eCookbook first release !' | |
53 | assert_select 'h2', :text => /eCookbook first release/ |
|
|||
54 | end |
|
50 | end | |
55 |
|
51 | |||
56 | def test_show_should_show_attachments |
|
52 | def test_show_should_show_attachments | |
@@ -71,7 +67,9 class NewsControllerTest < Redmine::ControllerTest | |||||
71 | @request.session[:user_id] = 1 |
|
67 | @request.session[:user_id] = 1 | |
72 | get :show, :id => 1 |
|
68 | get :show, :id => 1 | |
73 | assert_response :success |
|
69 | assert_response :success | |
74 | assert_equal News.find(1).comments.to_a.sort_by(&:created_on).reverse, assigns(:comments) |
|
70 | ||
|
71 | comments = css_select('#comments .wiki').map(&:text).map(&:strip) | |||
|
72 | assert_equal ["This is an other comment", "my first comment"], comments | |||
75 | end |
|
73 | end | |
76 |
|
74 | |||
77 | def test_show_not_found |
|
75 | def test_show_not_found | |
@@ -83,7 +81,7 class NewsControllerTest < Redmine::ControllerTest | |||||
83 | @request.session[:user_id] = 2 |
|
81 | @request.session[:user_id] = 2 | |
84 | get :new, :project_id => 1 |
|
82 | get :new, :project_id => 1 | |
85 | assert_response :success |
|
83 | assert_response :success | |
86 | assert_template 'new' |
|
84 | assert_select 'input[name=?]', 'news[title]' | |
87 | end |
|
85 | end | |
88 |
|
86 | |||
89 | def test_post_create |
|
87 | def test_post_create | |
@@ -126,9 +124,6 class NewsControllerTest < Redmine::ControllerTest | |||||
126 | :description => 'This is the description', |
|
124 | :description => 'This is the description', | |
127 | :summary => '' } |
|
125 | :summary => '' } | |
128 | assert_response :success |
|
126 | assert_response :success | |
129 | assert_template 'new' |
|
|||
130 | assert_not_nil assigns(:news) |
|
|||
131 | assert assigns(:news).new_record? |
|
|||
132 | assert_select_error /title cannot be blank/i |
|
127 | assert_select_error /title cannot be blank/i | |
133 | end |
|
128 | end | |
134 |
|
129 | |||
@@ -136,7 +131,7 class NewsControllerTest < Redmine::ControllerTest | |||||
136 | @request.session[:user_id] = 2 |
|
131 | @request.session[:user_id] = 2 | |
137 | get :edit, :id => 1 |
|
132 | get :edit, :id => 1 | |
138 | assert_response :success |
|
133 | assert_response :success | |
139 | assert_template 'edit' |
|
134 | assert_select 'input[name=?][value=?]', 'news[title]', 'eCookbook first release !' | |
140 | end |
|
135 | end | |
141 |
|
136 | |||
142 | def test_put_update |
|
137 | def test_put_update | |
@@ -165,7 +160,6 class NewsControllerTest < Redmine::ControllerTest | |||||
165 | @request.session[:user_id] = 2 |
|
160 | @request.session[:user_id] = 2 | |
166 | put :update, :id => 1, :news => { :description => '' } |
|
161 | put :update, :id => 1, :news => { :description => '' } | |
167 | assert_response :success |
|
162 | assert_response :success | |
168 | assert_template 'edit' |
|
|||
169 | assert_select_error /description cannot be blank/i |
|
163 | assert_select_error /description cannot be blank/i | |
170 | end |
|
164 | end | |
171 |
|
165 |
@@ -32,25 +32,35 class PreviewsControllerTest < Redmine::ControllerTest | |||||
32 | @request.session[:user_id] = 2 |
|
32 | @request.session[:user_id] = 2 | |
33 | post :issue, :project_id => '1', :issue => {:description => 'Foo'} |
|
33 | post :issue, :project_id => '1', :issue => {:description => 'Foo'} | |
34 | assert_response :success |
|
34 | assert_response :success | |
35 | assert_template 'previews/issue' |
|
35 | assert_select 'fieldset' do | |
36 | assert_not_nil assigns(:description) |
|
36 | assert_select 'legend', :text => 'Description' | |
|
37 | assert_select 'p', :text => 'Foo' | |||
|
38 | end | |||
37 | end |
|
39 | end | |
38 |
|
40 | |||
39 | def test_preview_issue_notes |
|
41 | def test_preview_issue_notes_with_no_change_to_description | |
40 | @request.session[:user_id] = 2 |
|
42 | @request.session[:user_id] = 2 | |
41 | post :issue, :project_id => '1', :id => 1, |
|
43 | post :issue, :project_id => '1', :id => 1, | |
42 | :issue => {:description => Issue.find(1).description, :notes => 'Foo'} |
|
44 | :issue => {:description => Issue.find(1).description, :notes => 'Foo'} | |
43 | assert_response :success |
|
45 | assert_response :success | |
44 | assert_template 'previews/issue' |
|
46 | assert_select 'legend', :text => 'Description', :count => 0 | |
45 | assert_not_nil assigns(:notes) |
|
47 | assert_select 'legend', :text => 'Notes' | |
|
48 | end | |||
|
49 | ||||
|
50 | def test_preview_issue_notes_with_no_change_to_description | |||
|
51 | @request.session[:user_id] = 2 | |||
|
52 | post :issue, :project_id => '1', :id => 1, | |||
|
53 | :issue => {:description => 'Changed description', :notes => 'Foo'} | |||
|
54 | assert_response :success | |||
|
55 | assert_select 'legend', :text => 'Description' | |||
|
56 | assert_select 'legend', :text => 'Notes' | |||
46 | end |
|
57 | end | |
47 |
|
58 | |||
48 | def test_preview_journal_notes_for_update |
|
59 | def test_preview_journal_notes_for_update | |
49 | @request.session[:user_id] = 2 |
|
60 | @request.session[:user_id] = 2 | |
50 | post :issue, :project_id => '1', :id => 1, :notes => 'Foo' |
|
61 | post :issue, :project_id => '1', :id => 1, :notes => 'Foo' | |
51 | assert_response :success |
|
62 | assert_response :success | |
52 | assert_template 'previews/issue' |
|
63 | assert_select 'legend', :text => 'Notes' | |
53 | assert_not_nil assigns(:notes) |
|
|||
54 | assert_select 'p', :text => 'Foo' |
|
64 | assert_select 'p', :text => 'Foo' | |
55 | end |
|
65 | end | |
56 |
|
66 | |||
@@ -66,8 +76,7 class PreviewsControllerTest < Redmine::ControllerTest | |||||
66 | @request.session[:user_id] = 2 |
|
76 | @request.session[:user_id] = 2 | |
67 | post :issue, :project_id => '1', :id => 1, :issue => {:notes => 'notes', :project_id => 2} |
|
77 | post :issue, :project_id => '1', :id => 1, :issue => {:notes => 'notes', :project_id => 2} | |
68 | assert_response :success |
|
78 | assert_response :success | |
69 | assert_not_nil assigns(:issue) |
|
79 | assert_select 'legend', :text => 'Notes' | |
70 | assert_not_nil assigns(:notes) |
|
|||
71 | end |
|
80 | end | |
72 |
|
81 | |||
73 | def test_preview_new_news |
|
82 | def test_preview_new_news | |
@@ -76,20 +85,15 class PreviewsControllerTest < Redmine::ControllerTest | |||||
76 | :description => 'News description', |
|
85 | :description => 'News description', | |
77 | :summary => ''} |
|
86 | :summary => ''} | |
78 | assert_response :success |
|
87 | assert_response :success | |
79 | assert_template 'common/_preview' |
|
|||
80 | assert_select 'fieldset.preview', :text => /News description/ |
|
88 | assert_select 'fieldset.preview', :text => /News description/ | |
81 | end |
|
89 | end | |
82 |
|
90 | |||
83 |
def test_existing |
|
91 | def test_preview_existing_news | |
84 | get :news, :project_id => 1, :id => 2, |
|
92 | get :news, :project_id => 1, :id => 2, | |
85 | :news => {:title => '', |
|
93 | :news => {:title => '', | |
86 | :description => 'News description', |
|
94 | :description => 'News description', | |
87 | :summary => ''} |
|
95 | :summary => ''} | |
88 | assert_response :success |
|
96 | assert_response :success | |
89 | assert_template 'common/_preview' |
|
|||
90 | assert_equal News.find(2), assigns(:previewed) |
|
|||
91 | assert_not_nil assigns(:attachments) |
|
|||
92 |
|
||||
93 | assert_select 'fieldset.preview', :text => /News description/ |
|
97 | assert_select 'fieldset.preview', :text => /News description/ | |
94 | end |
|
98 | end | |
95 | end |
|
99 | end |
@@ -86,7 +86,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
86 | assert_difference 'Member.count' do |
|
86 | assert_difference 'Member.count' do | |
87 | xhr :post, :create, :user_id => 7, :membership => {:project_ids => [3], :role_ids => [2]}, :format => 'js' |
|
87 | xhr :post, :create, :user_id => 7, :membership => {:project_ids => [3], :role_ids => [2]}, :format => 'js' | |
88 | assert_response :success |
|
88 | assert_response :success | |
89 | assert_template 'create' |
|
|||
90 | assert_equal 'text/javascript', response.content_type |
|
89 | assert_equal 'text/javascript', response.content_type | |
91 | end |
|
90 | end | |
92 | member = Member.order('id DESC').first |
|
91 | member = Member.order('id DESC').first | |
@@ -100,7 +99,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
100 | assert_no_difference 'Member.count' do |
|
99 | assert_no_difference 'Member.count' do | |
101 | xhr :post, :create, :user_id => 7, :membership => {:project_ids => [3]}, :format => 'js' |
|
100 | xhr :post, :create, :user_id => 7, :membership => {:project_ids => [3]}, :format => 'js' | |
102 | assert_response :success |
|
101 | assert_response :success | |
103 | assert_template 'create' |
|
|||
104 | assert_equal 'text/javascript', response.content_type |
|
102 | assert_equal 'text/javascript', response.content_type | |
105 | end |
|
103 | end | |
106 | assert_include 'alert', response.body, "Alert message not sent" |
|
104 | assert_include 'alert', response.body, "Alert message not sent" | |
@@ -119,7 +117,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
119 | assert_no_difference 'Member.count' do |
|
117 | assert_no_difference 'Member.count' do | |
120 | xhr :put, :update, :user_id => 2, :id => 1, :membership => {:role_ids => [2]}, :format => 'js' |
|
118 | xhr :put, :update, :user_id => 2, :id => 1, :membership => {:role_ids => [2]}, :format => 'js' | |
121 | assert_response :success |
|
119 | assert_response :success | |
122 | assert_template 'update' |
|
|||
123 | assert_equal 'text/javascript', response.content_type |
|
120 | assert_equal 'text/javascript', response.content_type | |
124 | end |
|
121 | end | |
125 | assert_equal [2], Member.find(1).role_ids |
|
122 | assert_equal [2], Member.find(1).role_ids | |
@@ -138,7 +135,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
138 | assert_difference 'Member.count', -1 do |
|
135 | assert_difference 'Member.count', -1 do | |
139 | xhr :delete, :destroy, :user_id => 2, :id => 1 |
|
136 | xhr :delete, :destroy, :user_id => 2, :id => 1 | |
140 | assert_response :success |
|
137 | assert_response :success | |
141 | assert_template 'destroy' |
|
|||
142 | assert_equal 'text/javascript', response.content_type |
|
138 | assert_equal 'text/javascript', response.content_type | |
143 | end |
|
139 | end | |
144 | assert_nil Member.find_by_id(1) |
|
140 | assert_nil Member.find_by_id(1) | |
@@ -161,7 +157,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
161 | assert_difference 'Group.find(10).members.count' do |
|
157 | assert_difference 'Group.find(10).members.count' do | |
162 | xhr :post, :create, :group_id => 10, :membership => {:project_ids => [2], :role_ids => ['1', '2']} |
|
158 | xhr :post, :create, :group_id => 10, :membership => {:project_ids => [2], :role_ids => ['1', '2']} | |
163 | assert_response :success |
|
159 | assert_response :success | |
164 | assert_template 'create' |
|
|||
165 | assert_equal 'text/javascript', response.content_type |
|
160 | assert_equal 'text/javascript', response.content_type | |
166 | end |
|
161 | end | |
167 | assert_match /OnlineStore/, response.body |
|
162 | assert_match /OnlineStore/, response.body | |
@@ -171,7 +166,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
171 | assert_no_difference 'Group.find(10).members.count' do |
|
166 | assert_no_difference 'Group.find(10).members.count' do | |
172 | xhr :post, :create, :group_id => 10, :membership => {:project_ids => [999], :role_ids => ['1', '2']} |
|
167 | xhr :post, :create, :group_id => 10, :membership => {:project_ids => [999], :role_ids => ['1', '2']} | |
173 | assert_response :success |
|
168 | assert_response :success | |
174 | assert_template 'create' |
|
|||
175 | assert_equal 'text/javascript', response.content_type |
|
169 | assert_equal 'text/javascript', response.content_type | |
176 | end |
|
170 | end | |
177 | assert_match /alert/, response.body, "Alert message not sent" |
|
171 | assert_match /alert/, response.body, "Alert message not sent" | |
@@ -187,7 +181,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
187 | assert_no_difference 'Group.find(10).members.count' do |
|
181 | assert_no_difference 'Group.find(10).members.count' do | |
188 | xhr :post, :update, :group_id => 10, :id => 6, :membership => {:role_ids => ['1', '3']} |
|
182 | xhr :post, :update, :group_id => 10, :id => 6, :membership => {:role_ids => ['1', '3']} | |
189 | assert_response :success |
|
183 | assert_response :success | |
190 | assert_template 'update' |
|
|||
191 | assert_equal 'text/javascript', response.content_type |
|
184 | assert_equal 'text/javascript', response.content_type | |
192 | end |
|
185 | end | |
193 | end |
|
186 | end | |
@@ -202,7 +195,6 class PrincipalMembershipsControllerTest < Redmine::ControllerTest | |||||
202 | assert_difference 'Group.find(10).members.count', -1 do |
|
195 | assert_difference 'Group.find(10).members.count', -1 do | |
203 | xhr :delete, :destroy, :group_id => 10, :id => 6 |
|
196 | xhr :delete, :destroy, :group_id => 10, :id => 6 | |
204 | assert_response :success |
|
197 | assert_response :success | |
205 | assert_template 'destroy' |
|
|||
206 | assert_equal 'text/javascript', response.content_type |
|
198 | assert_equal 'text/javascript', response.content_type | |
207 | end |
|
199 | end | |
208 | end |
|
200 | end |
@@ -33,10 +33,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
33 | def test_index_by_anonymous_should_not_show_private_projects |
|
33 | def test_index_by_anonymous_should_not_show_private_projects | |
34 | get :index |
|
34 | get :index | |
35 | assert_response :success |
|
35 | assert_response :success | |
36 | assert_template 'index' |
|
|||
37 | projects = assigns(:projects) |
|
|||
38 | assert_not_nil projects |
|
|||
39 | assert projects.all?(&:is_public?) |
|
|||
40 |
|
36 | |||
41 | assert_select 'ul' do |
|
37 | assert_select 'ul' do | |
42 | assert_select 'li' do |
|
38 | assert_select 'li' do | |
@@ -52,7 +48,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
52 | def test_index_atom |
|
48 | def test_index_atom | |
53 | get :index, :format => 'atom' |
|
49 | get :index, :format => 'atom' | |
54 | assert_response :success |
|
50 | assert_response :success | |
55 | assert_template 'common/feed' |
|
|||
56 | assert_select 'feed>title', :text => 'Redmine: Latest projects' |
|
51 | assert_select 'feed>title', :text => 'Redmine: Latest projects' | |
57 | assert_select 'feed>entry', :count => Project.visible(User.current).count |
|
52 | assert_select 'feed>entry', :count => Project.visible(User.current).count | |
58 | end |
|
53 | end | |
@@ -60,7 +55,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
60 | test "#index by non-admin user with view_time_entries permission should show overall spent time link" do |
|
55 | test "#index by non-admin user with view_time_entries permission should show overall spent time link" do | |
61 | @request.session[:user_id] = 3 |
|
56 | @request.session[:user_id] = 3 | |
62 | get :index |
|
57 | get :index | |
63 | assert_template 'index' |
|
|||
64 | assert_select 'a[href=?]', '/time_entries' |
|
58 | assert_select 'a[href=?]', '/time_entries' | |
65 | end |
|
59 | end | |
66 |
|
60 | |||
@@ -71,15 +65,14 class ProjectsControllerTest < Redmine::ControllerTest | |||||
71 | @request.session[:user_id] = 3 |
|
65 | @request.session[:user_id] = 3 | |
72 |
|
66 | |||
73 | get :index |
|
67 | get :index | |
74 | assert_template 'index' |
|
|||
75 | assert_select 'a[href=?]', '/time_entries', 0 |
|
68 | assert_select 'a[href=?]', '/time_entries', 0 | |
76 | end |
|
69 | end | |
77 |
|
70 | |||
78 | test "#index by non-admin user with permission should show add project link" do |
|
71 | test "#index by non-admin user with permission should show add project link" do | |
79 | Role.find(1).add_permission! :add_project |
|
72 | Role.find(1).add_permission! :add_project | |
80 | @request.session[:user_id] = 2 |
|
73 | @request.session[:user_id] = 2 | |
|
74 | ||||
81 | get :index |
|
75 | get :index | |
82 | assert_template 'index' |
|
|||
83 | assert_select 'a[href=?]', '/projects/new' |
|
76 | assert_select 'a[href=?]', '/projects/new' | |
84 | end |
|
77 | end | |
85 |
|
78 | |||
@@ -88,7 +81,8 class ProjectsControllerTest < Redmine::ControllerTest | |||||
88 |
|
81 | |||
89 | get :new |
|
82 | get :new | |
90 | assert_response :success |
|
83 | assert_response :success | |
91 | assert_template 'new' |
|
84 | assert_select 'input[name=?]', 'project[name]' | |
|
85 | assert_select 'select[name=?]', 'project[parent_id]' | |||
92 | end |
|
86 | end | |
93 |
|
87 | |||
94 | test "#new by non-admin user with add_project permission should accept get" do |
|
88 | test "#new by non-admin user with add_project permission should accept get" do | |
@@ -97,7 +91,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
97 |
|
91 | |||
98 | get :new |
|
92 | get :new | |
99 | assert_response :success |
|
93 | assert_response :success | |
100 | assert_template 'new' |
|
94 | assert_select 'input[name=?]', 'project[name]' | |
101 | assert_select 'select[name=?]', 'project[parent_id]', 0 |
|
95 | assert_select 'select[name=?]', 'project[parent_id]', 0 | |
102 | end |
|
96 | end | |
103 |
|
97 | |||
@@ -108,7 +102,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
108 |
|
102 | |||
109 | get :new, :parent_id => 'ecookbook' |
|
103 | get :new, :parent_id => 'ecookbook' | |
110 | assert_response :success |
|
104 | assert_response :success | |
111 | assert_template 'new' |
|
|||
112 |
|
105 | |||
113 | assert_select 'select[name=?]', 'project[parent_id]' do |
|
106 | assert_select 'select[name=?]', 'project[parent_id]' do | |
114 | # parent project selected |
|
107 | # parent project selected | |
@@ -215,6 +208,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
215 |
|
208 | |||
216 | test "#create by non-admin user with add_project permission should fail with parent_id" do |
|
209 | test "#create by non-admin user with add_project permission should fail with parent_id" do | |
217 | Role.non_member.add_permission! :add_project |
|
210 | Role.non_member.add_permission! :add_project | |
|
211 | User.find(9).update! :language => 'en' | |||
218 | @request.session[:user_id] = 9 |
|
212 | @request.session[:user_id] = 9 | |
219 |
|
213 | |||
220 | assert_no_difference 'Project.count' do |
|
214 | assert_no_difference 'Project.count' do | |
@@ -227,9 +221,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
227 | } |
|
221 | } | |
228 | end |
|
222 | end | |
229 | assert_response :success |
|
223 | assert_response :success | |
230 | project = assigns(:project) |
|
224 | assert_select_error /Subproject of is invalid/ | |
231 | assert_kind_of Project, project |
|
|||
232 | assert_not_equal [], project.errors[:parent_id] |
|
|||
233 | end |
|
225 | end | |
234 |
|
226 | |||
235 | test "#create by non-admin user with add_subprojects permission should create a project with a parent_id" do |
|
227 | test "#create by non-admin user with add_subprojects permission should create a project with a parent_id" do | |
@@ -246,6 +238,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
246 | } |
|
238 | } | |
247 | assert_redirected_to '/projects/blog/settings' |
|
239 | assert_redirected_to '/projects/blog/settings' | |
248 | project = Project.find_by_name('blog') |
|
240 | project = Project.find_by_name('blog') | |
|
241 | assert_equal 1, project.parent_id | |||
249 | end |
|
242 | end | |
250 |
|
243 | |||
251 | test "#create by non-admin user with add_subprojects permission should fail without parent_id" do |
|
244 | test "#create by non-admin user with add_subprojects permission should fail without parent_id" do | |
@@ -262,9 +255,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
262 | } |
|
255 | } | |
263 | end |
|
256 | end | |
264 | assert_response :success |
|
257 | assert_response :success | |
265 | project = assigns(:project) |
|
258 | assert_select_error /Subproject of is invalid/ | |
266 | assert_kind_of Project, project |
|
|||
267 | assert_not_equal [], project.errors[:parent_id] |
|
|||
268 | end |
|
259 | end | |
269 |
|
260 | |||
270 | test "#create by non-admin user with add_subprojects permission should fail with unauthorized parent_id" do |
|
261 | test "#create by non-admin user with add_subprojects permission should fail with unauthorized parent_id" do | |
@@ -283,9 +274,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
283 | } |
|
274 | } | |
284 | end |
|
275 | end | |
285 | assert_response :success |
|
276 | assert_response :success | |
286 | project = assigns(:project) |
|
277 | assert_select_error /Subproject of is invalid/ | |
287 | assert_kind_of Project, project |
|
|||
288 | assert_not_equal [], project.errors[:parent_id] |
|
|||
289 | end |
|
278 | end | |
290 |
|
279 | |||
291 | def test_create_subproject_with_inherit_members_should_inherit_members |
|
280 | def test_create_subproject_with_inherit_members_should_inherit_members | |
@@ -318,26 +307,23 class ProjectsControllerTest < Redmine::ControllerTest | |||||
318 | } |
|
307 | } | |
319 | end |
|
308 | end | |
320 | assert_response :success |
|
309 | assert_response :success | |
321 | project = assigns(:project) |
|
310 | %w(issue_tracking news).each do |mod| | |
322 | assert_equal %w(issue_tracking news), project.enabled_module_names.sort |
|
311 | assert_select 'input[name=?][value=?][checked=checked]', 'project[enabled_module_names][]', mod | |
|
312 | end | |||
|
313 | assert_select 'input[name=?][checked=checked]', 'project[enabled_module_names][]', :count => 2 | |||
323 | end |
|
314 | end | |
324 | end |
|
315 | end | |
325 |
|
316 | |||
326 | def test_show_by_id |
|
317 | def test_show_by_id | |
327 | get :show, :id => 1 |
|
318 | get :show, :id => 1 | |
328 | assert_response :success |
|
319 | assert_response :success | |
329 | assert_template 'show' |
|
320 | assert_select '#header h1', :text => "eCookbook" | |
330 | assert_not_nil assigns(:project) |
|
|||
331 | end |
|
321 | end | |
332 |
|
322 | |||
333 | def test_show_by_identifier |
|
323 | def test_show_by_identifier | |
334 | get :show, :id => 'ecookbook' |
|
324 | get :show, :id => 'ecookbook' | |
335 | assert_response :success |
|
325 | assert_response :success | |
336 | assert_template 'show' |
|
326 | assert_select '#header h1', :text => "eCookbook" | |
337 | assert_not_nil assigns(:project) |
|
|||
338 | assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) |
|
|||
339 |
|
||||
340 | assert_select 'li', :text => /Development status/ |
|
|||
341 | end |
|
327 | end | |
342 |
|
328 | |||
343 | def test_show_should_not_display_empty_sidebar |
|
329 | def test_show_should_not_display_empty_sidebar | |
@@ -350,12 +336,18 class ProjectsControllerTest < Redmine::ControllerTest | |||||
350 | assert_select '#main.nosidebar' |
|
336 | assert_select '#main.nosidebar' | |
351 | end |
|
337 | end | |
352 |
|
338 | |||
|
339 | def test_show_should_display_visible_custom_fields | |||
|
340 | ProjectCustomField.find_by_name('Development status').update_attribute :visible, true | |||
|
341 | get :show, :id => 'ecookbook' | |||
|
342 | assert_response :success | |||
|
343 | ||||
|
344 | assert_select 'li', :text => /Development status/ | |||
|
345 | end | |||
|
346 | ||||
353 | def test_show_should_not_display_hidden_custom_fields |
|
347 | def test_show_should_not_display_hidden_custom_fields | |
354 | ProjectCustomField.find_by_name('Development status').update_attribute :visible, false |
|
348 | ProjectCustomField.find_by_name('Development status').update_attribute :visible, false | |
355 | get :show, :id => 'ecookbook' |
|
349 | get :show, :id => 'ecookbook' | |
356 | assert_response :success |
|
350 | assert_response :success | |
357 | assert_template 'show' |
|
|||
358 | assert_not_nil assigns(:project) |
|
|||
359 |
|
351 | |||
360 | assert_select 'li', :text => /Development status/, :count => 0 |
|
352 | assert_select 'li', :text => /Development status/, :count => 0 | |
361 | end |
|
353 | end | |
@@ -386,9 +378,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
386 | project.custom_values.first.update_attribute(:value, nil) |
|
378 | project.custom_values.first.update_attribute(:value, nil) | |
387 | get :show, :id => 'ecookbook' |
|
379 | get :show, :id => 'ecookbook' | |
388 | assert_response :success |
|
380 | assert_response :success | |
389 | assert_template 'show' |
|
|||
390 | assert_not_nil assigns(:project) |
|
|||
391 | assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) |
|
|||
392 | end |
|
381 | end | |
393 |
|
382 | |||
394 | def show_archived_project_should_be_denied |
|
383 | def show_archived_project_should_be_denied | |
@@ -397,14 +386,13 class ProjectsControllerTest < Redmine::ControllerTest | |||||
397 |
|
386 | |||
398 | get :show, :id => 'ecookbook' |
|
387 | get :show, :id => 'ecookbook' | |
399 | assert_response 403 |
|
388 | assert_response 403 | |
400 | assert_nil assigns(:project) |
|
|||
401 | assert_select 'p', :text => /archived/ |
|
389 | assert_select 'p', :text => /archived/ | |
|
390 | assert_not_include project.name, response.body | |||
402 | end |
|
391 | end | |
403 |
|
392 | |||
404 | def test_show_should_not_show_private_subprojects_that_are_not_visible |
|
393 | def test_show_should_not_show_private_subprojects_that_are_not_visible | |
405 | get :show, :id => 'ecookbook' |
|
394 | get :show, :id => 'ecookbook' | |
406 | assert_response :success |
|
395 | assert_response :success | |
407 | assert_template 'show' |
|
|||
408 | assert_select 'a', :text => /Private child/, :count => 0 |
|
396 | assert_select 'a', :text => /Private child/, :count => 0 | |
409 | end |
|
397 | end | |
410 |
|
398 | |||
@@ -412,7 +400,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
412 | @request.session[:user_id] = 2 # manager who is a member of the private subproject |
|
400 | @request.session[:user_id] = 2 # manager who is a member of the private subproject | |
413 | get :show, :id => 'ecookbook' |
|
401 | get :show, :id => 'ecookbook' | |
414 | assert_response :success |
|
402 | assert_response :success | |
415 | assert_template 'show' |
|
|||
416 | assert_select 'a', :text => /Private child/ |
|
403 | assert_select 'a', :text => /Private child/ | |
417 | end |
|
404 | end | |
418 |
|
405 | |||
@@ -420,14 +407,14 class ProjectsControllerTest < Redmine::ControllerTest | |||||
420 | @request.session[:user_id] = 2 # manager |
|
407 | @request.session[:user_id] = 2 # manager | |
421 | get :settings, :id => 1 |
|
408 | get :settings, :id => 1 | |
422 | assert_response :success |
|
409 | assert_response :success | |
423 | assert_template 'settings' |
|
410 | ||
|
411 | assert_select 'input[name=?]', 'project[name]' | |||
424 | end |
|
412 | end | |
425 |
|
413 | |||
426 | def test_settings_of_subproject |
|
414 | def test_settings_of_subproject | |
427 | @request.session[:user_id] = 2 |
|
415 | @request.session[:user_id] = 2 | |
428 | get :settings, :id => 'private-child' |
|
416 | get :settings, :id => 'private-child' | |
429 | assert_response :success |
|
417 | assert_response :success | |
430 | assert_template 'settings' |
|
|||
431 |
|
418 | |||
432 | assert_select 'input[type=checkbox][name=?]', 'project[inherit_members]' |
|
419 | assert_select 'input[type=checkbox][name=?]', 'project[inherit_members]' | |
433 | end |
|
420 | end | |
@@ -454,7 +441,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
454 |
|
441 | |||
455 | get :settings, :id => 1 |
|
442 | get :settings, :id => 1 | |
456 | assert_response :success |
|
443 | assert_response :success | |
457 | assert_template 'settings' |
|
|||
458 |
|
444 | |||
459 | assert_select 'form[action=?]', '/projects/ecookbook/wiki' do |
|
445 | assert_select 'form[action=?]', '/projects/ecookbook/wiki' do | |
460 | assert_select 'input[name=?]', 'wiki[start_page]' |
|
446 | assert_select 'input[name=?]', 'wiki[start_page]' | |
@@ -474,7 +460,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
474 | @request.session[:user_id] = 2 # manager |
|
460 | @request.session[:user_id] = 2 # manager | |
475 | post :update, :id => 1, :project => {:name => ''} |
|
461 | post :update, :id => 1, :project => {:name => ''} | |
476 | assert_response :success |
|
462 | assert_response :success | |
477 | assert_template 'settings' |
|
|||
478 | assert_select_error /name cannot be blank/i |
|
463 | assert_select_error /name cannot be blank/i | |
479 | end |
|
464 | end | |
480 |
|
465 | |||
@@ -521,8 +506,8 class ProjectsControllerTest < Redmine::ControllerTest | |||||
521 | assert_no_difference 'Project.count' do |
|
506 | assert_no_difference 'Project.count' do | |
522 | delete :destroy, :id => 2 |
|
507 | delete :destroy, :id => 2 | |
523 | assert_response :success |
|
508 | assert_response :success | |
524 | assert_template 'destroy' |
|
|||
525 | end |
|
509 | end | |
|
510 | assert_select '.warning', :text => /Are you sure you want to delete this project/ | |||
526 | end |
|
511 | end | |
527 |
|
512 | |||
528 | def test_destroy_without_confirmation_should_show_confirmation_with_subprojects |
|
513 | def test_destroy_without_confirmation_should_show_confirmation_with_subprojects | |
@@ -531,7 +516,6 class ProjectsControllerTest < Redmine::ControllerTest | |||||
531 | assert_no_difference 'Project.count' do |
|
516 | assert_no_difference 'Project.count' do | |
532 | delete :destroy, :id => 1 |
|
517 | delete :destroy, :id => 1 | |
533 | assert_response :success |
|
518 | assert_response :success | |
534 | assert_template 'destroy' |
|
|||
535 | end |
|
519 | end | |
536 | assert_select 'strong', |
|
520 | assert_select 'strong', | |
537 | :text => ['Private child of eCookbook', |
|
521 | :text => ['Private child of eCookbook', | |
@@ -603,13 +587,12 class ProjectsControllerTest < Redmine::ControllerTest | |||||
603 |
|
587 | |||
604 | def test_get_copy |
|
588 | def test_get_copy | |
605 | @request.session[:user_id] = 1 # admin |
|
589 | @request.session[:user_id] = 1 # admin | |
606 | get :copy, :id => 1 |
|
590 | orig = Project.find(1) | |
|
591 | ||||
|
592 | get :copy, :id => orig.id | |||
607 | assert_response :success |
|
593 | assert_response :success | |
608 | assert_template 'copy' |
|
|||
609 | assert assigns(:project) |
|
|||
610 | assert_equal Project.find(1).description, assigns(:project).description |
|
|||
611 | assert_nil assigns(:project).id |
|
|||
612 |
|
594 | |||
|
595 | assert_select 'textarea[name=?]', 'project[description]', :text => orig.description | |||
613 | assert_select 'input[name=?][value=?]', 'project[enabled_module_names][]', 'issue_tracking', 1 |
|
596 | assert_select 'input[name=?][value=?]', 'project[enabled_module_names][]', 'issue_tracking', 1 | |
614 | end |
|
597 | end | |
615 |
|
598 | |||
@@ -667,7 +650,7 class ProjectsControllerTest < Redmine::ControllerTest | |||||
667 | @request.session[:user_id] = 1 |
|
650 | @request.session[:user_id] = 1 | |
668 | post :copy, :id => 1, :project => {:name => 'Copy', :identifier => ''} |
|
651 | post :copy, :id => 1, :project => {:name => 'Copy', :identifier => ''} | |
669 | assert_response :success |
|
652 | assert_response :success | |
670 | assert_template 'copy' |
|
653 | assert_select_error /Identifier cannot be blank/ | |
671 | end |
|
654 | end | |
672 |
|
655 | |||
673 | def test_jump_should_redirect_to_active_tab |
|
656 | def test_jump_should_redirect_to_active_tab | |
@@ -678,13 +661,11 class ProjectsControllerTest < Redmine::ControllerTest | |||||
678 | def test_jump_should_not_redirect_to_inactive_tab |
|
661 | def test_jump_should_not_redirect_to_inactive_tab | |
679 | get :show, :id => 3, :jump => 'documents' |
|
662 | get :show, :id => 3, :jump => 'documents' | |
680 | assert_response :success |
|
663 | assert_response :success | |
681 | assert_template 'show' |
|
|||
682 | end |
|
664 | end | |
683 |
|
665 | |||
684 | def test_jump_should_not_redirect_to_unknown_tab |
|
666 | def test_jump_should_not_redirect_to_unknown_tab | |
685 | get :show, :id => 3, :jump => 'foobar' |
|
667 | get :show, :id => 3, :jump => 'foobar' | |
686 | assert_response :success |
|
668 | assert_response :success | |
687 | assert_template 'show' |
|
|||
688 | end |
|
669 | end | |
689 |
|
670 | |||
690 | def test_body_should_have_project_css_class |
|
671 | def test_body_should_have_project_css_class |
@@ -34,7 +34,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
34 | @request.session[:user_id] = 2 |
|
34 | @request.session[:user_id] = 2 | |
35 | get :new, :project_id => 1 |
|
35 | get :new, :project_id => 1 | |
36 | assert_response :success |
|
36 | assert_response :success | |
37 | assert_template 'new' |
|
37 | ||
38 | assert_select 'input[name=?][value="0"][checked=checked]', 'query[visibility]' |
|
38 | assert_select 'input[name=?][value="0"][checked=checked]', 'query[visibility]' | |
39 | assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])' |
|
39 | assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])' | |
40 | assert_select 'select[name=?]', 'c[]' do |
|
40 | assert_select 'select[name=?]', 'c[]' do | |
@@ -47,7 +47,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
47 | @request.session[:user_id] = 2 |
|
47 | @request.session[:user_id] = 2 | |
48 | get :new |
|
48 | get :new | |
49 | assert_response :success |
|
49 | assert_response :success | |
50 | assert_template 'new' |
|
50 | ||
51 | assert_select 'input[name=?]', 'query[visibility]', 0 |
|
51 | assert_select 'input[name=?]', 'query[visibility]', 0 | |
52 | assert_select 'input[name=query_is_for_all][type=checkbox][checked]:not([disabled])' |
|
52 | assert_select 'input[name=query_is_for_all][type=checkbox][checked]:not([disabled])' | |
53 | end |
|
53 | end | |
@@ -169,7 +169,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
169 | post :create, :project_id => 'ecookbook', :query => {:name => ''} |
|
169 | post :create, :project_id => 'ecookbook', :query => {:name => ''} | |
170 | end |
|
170 | end | |
171 | assert_response :success |
|
171 | assert_response :success | |
172 | assert_template 'new' |
|
172 | ||
173 | assert_select 'input[name=?]', 'query[name]' |
|
173 | assert_select 'input[name=?]', 'query[name]' | |
174 | end |
|
174 | end | |
175 |
|
175 | |||
@@ -294,7 +294,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
294 | @request.session[:user_id] = 1 |
|
294 | @request.session[:user_id] = 1 | |
295 | get :edit, :id => 4 |
|
295 | get :edit, :id => 4 | |
296 | assert_response :success |
|
296 | assert_response :success | |
297 | assert_template 'edit' |
|
297 | ||
298 | assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]' |
|
298 | assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]' | |
299 | assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]' |
|
299 | assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]' | |
300 | end |
|
300 | end | |
@@ -303,7 +303,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
303 | @request.session[:user_id] = 3 |
|
303 | @request.session[:user_id] = 3 | |
304 | get :edit, :id => 3 |
|
304 | get :edit, :id => 3 | |
305 | assert_response :success |
|
305 | assert_response :success | |
306 | assert_template 'edit' |
|
306 | ||
307 | assert_select 'input[name=?]', 'query[visibility]', 0 |
|
307 | assert_select 'input[name=?]', 'query[visibility]', 0 | |
308 | assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]' |
|
308 | assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]' | |
309 | end |
|
309 | end | |
@@ -312,7 +312,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
312 | @request.session[:user_id] = 3 |
|
312 | @request.session[:user_id] = 3 | |
313 | get :edit, :id => 2 |
|
313 | get :edit, :id => 2 | |
314 | assert_response :success |
|
314 | assert_response :success | |
315 | assert_template 'edit' |
|
315 | ||
316 | assert_select 'input[name=?]', 'query[visibility]', 0 |
|
316 | assert_select 'input[name=?]', 'query[visibility]', 0 | |
317 | assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked])' |
|
317 | assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked])' | |
318 | end |
|
318 | end | |
@@ -321,7 +321,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
321 | @request.session[:user_id] = 2 |
|
321 | @request.session[:user_id] = 2 | |
322 | get :edit, :id => 1 |
|
322 | get :edit, :id => 1 | |
323 | assert_response :success |
|
323 | assert_response :success | |
324 | assert_template 'edit' |
|
324 | ||
325 | assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]' |
|
325 | assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]' | |
326 | assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked])' |
|
326 | assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked])' | |
327 | end |
|
327 | end | |
@@ -330,7 +330,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
330 | @request.session[:user_id] = 1 |
|
330 | @request.session[:user_id] = 1 | |
331 | get :edit, :id => 5 |
|
331 | get :edit, :id => 5 | |
332 | assert_response :success |
|
332 | assert_response :success | |
333 | assert_template 'edit' |
|
333 | ||
334 | assert_select 'select[name=?]', 'query[sort_criteria][0][]' do |
|
334 | assert_select 'select[name=?]', 'query[sort_criteria][0][]' do | |
335 | assert_select 'option[value=priority][selected=selected]' |
|
335 | assert_select 'option[value=priority][selected=selected]' | |
336 | assert_select 'option[value=desc][selected=selected]' |
|
336 | assert_select 'option[value=desc][selected=selected]' | |
@@ -381,7 +381,7 class QueriesControllerTest < Redmine::ControllerTest | |||||
381 | @request.session[:user_id] = 1 |
|
381 | @request.session[:user_id] = 1 | |
382 | put :update, :id => 4, :query => {:name => ''} |
|
382 | put :update, :id => 4, :query => {:name => ''} | |
383 | assert_response :success |
|
383 | assert_response :success | |
384 | assert_template 'edit' |
|
384 | assert_select_error /Name cannot be blank/ | |
385 | end |
|
385 | end | |
386 |
|
386 | |||
387 | def test_destroy |
|
387 | def test_destroy | |
@@ -395,7 +395,6 class QueriesControllerTest < Redmine::ControllerTest | |||||
395 | @request.session[:user_id] = 2 |
|
395 | @request.session[:user_id] = 2 | |
396 | get :new, :subject => 'foo/bar' |
|
396 | get :new, :subject => 'foo/bar' | |
397 | assert_response :success |
|
397 | assert_response :success | |
398 | assert_template 'new' |
|
|||
399 | assert_include 'addFilter("subject", "=", ["foo\/bar"]);', response.body |
|
398 | assert_include 'addFilter("subject", "=", ["foo\/bar"]);', response.body | |
400 | end |
|
399 | end | |
401 | end |
|
400 | end |
@@ -29,28 +29,13 class ReportsControllerTest < Redmine::ControllerTest | |||||
29 |
|
29 | |||
30 | def test_get_issue_report |
|
30 | def test_get_issue_report | |
31 | get :issue_report, :id => 1 |
|
31 | get :issue_report, :id => 1 | |
32 |
|
||||
33 | assert_response :success |
|
32 | assert_response :success | |
34 | assert_template 'issue_report' |
|
|||
35 |
|
||||
36 | [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, |
|
|||
37 | :issues_by_author, :issues_by_subproject, :issues_by_priority].each do |ivar| |
|
|||
38 | assert_not_nil assigns(ivar) |
|
|||
39 | end |
|
|||
40 |
|
||||
41 | assert_equal IssuePriority.all.reverse, assigns(:priorities) |
|
|||
42 | end |
|
33 | end | |
43 |
|
34 | |||
44 | def test_get_issue_report_details |
|
35 | def test_get_issue_report_details | |
45 | %w(tracker version priority category assigned_to author subproject).each do |detail| |
|
36 | %w(tracker version priority category assigned_to author subproject).each do |detail| | |
46 | get :issue_report_details, :id => 1, :detail => detail |
|
37 | get :issue_report_details, :id => 1, :detail => detail | |
47 |
|
||||
48 | assert_response :success |
|
38 | assert_response :success | |
49 | assert_template 'issue_report_details' |
|
|||
50 | assert_not_nil assigns(:field) |
|
|||
51 | assert_not_nil assigns(:rows) |
|
|||
52 | assert_not_nil assigns(:data) |
|
|||
53 | assert_not_nil assigns(:report_title) |
|
|||
54 | end |
|
39 | end | |
55 | end |
|
40 | end | |
56 |
|
41 | |||
@@ -72,14 +57,8 class ReportsControllerTest < Redmine::ControllerTest | |||||
72 | end |
|
57 | end | |
73 | end |
|
58 | end | |
74 |
|
59 | |||
75 | def test_get_issue_report_details_by_priority |
|
|||
76 | get :issue_report_details, :id => 1, :detail => 'priority' |
|
|||
77 | assert_equal IssuePriority.all.reverse, assigns(:rows) |
|
|||
78 | end |
|
|||
79 |
|
||||
80 | def test_get_issue_report_details_with_an_invalid_detail |
|
60 | def test_get_issue_report_details_with_an_invalid_detail | |
81 | get :issue_report_details, :id => 1, :detail => 'invalid' |
|
61 | get :issue_report_details, :id => 1, :detail => 'invalid' | |
82 |
|
62 | assert_response 404 | ||
83 | assert_redirected_to '/projects/ecookbook/issues/report' |
|
|||
84 | end |
|
63 | end | |
85 | end |
|
64 | end |
General Comments 0
You need to be logged in to leave comments.
Login now