@@ -2871,24 +2871,6 class IssuesControllerTest < ActionController::TestCase | |||||
2871 | assert_equal spent_hours_before + 2.5, issue.spent_hours |
|
2871 | assert_equal spent_hours_before + 2.5, issue.spent_hours | |
2872 | end |
|
2872 | end | |
2873 |
|
2873 | |||
2874 | def test_put_update_with_spent_time_and_failure_should_not_add_spent_time |
|
|||
2875 | @request.session[:user_id] = 2 |
|
|||
2876 |
|
||||
2877 | assert_no_difference('TimeEntry.count') do |
|
|||
2878 | put :update, |
|
|||
2879 | :id => 1, |
|
|||
2880 | :issue => { :subject => '' }, |
|
|||
2881 | :time_entry => { :hours => '2.5', :comments => 'should not be added', :activity_id => TimeEntryActivity.first.id } |
|
|||
2882 | assert_response :success |
|
|||
2883 | end |
|
|||
2884 |
|
||||
2885 | assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2.5' |
|
|||
2886 | assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added' |
|
|||
2887 | assert_select 'select[name=?]', 'time_entry[activity_id]' do |
|
|||
2888 | assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id |
|
|||
2889 | end |
|
|||
2890 | end |
|
|||
2891 |
|
||||
2892 | def test_put_update_with_attachment_only |
|
2874 | def test_put_update_with_attachment_only | |
2893 | set_tmp_attachments_directory |
|
2875 | set_tmp_attachments_directory | |
2894 |
|
2876 |
@@ -235,6 +235,24 class IssuesControllerTransactionTest < ActionController::TestCase | |||||
235 | assert_nil issue.fixed_version_id |
|
235 | assert_nil issue.fixed_version_id | |
236 | end |
|
236 | end | |
237 |
|
237 | |||
|
238 | def test_put_update_with_spent_time_and_failure_should_not_add_spent_time | |||
|
239 | @request.session[:user_id] = 2 | |||
|
240 | ||||
|
241 | assert_no_difference('TimeEntry.count') do | |||
|
242 | put :update, | |||
|
243 | :id => 1, | |||
|
244 | :issue => { :subject => '' }, | |||
|
245 | :time_entry => { :hours => '2.5', :comments => 'should not be added', :activity_id => TimeEntryActivity.first.id } | |||
|
246 | assert_response :success | |||
|
247 | end | |||
|
248 | ||||
|
249 | assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2.5' | |||
|
250 | assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added' | |||
|
251 | assert_select 'select[name=?]', 'time_entry[activity_id]' do | |||
|
252 | assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id | |||
|
253 | end | |||
|
254 | end | |||
|
255 | ||||
238 | def test_index_should_rescue_invalid_sql_query |
|
256 | def test_index_should_rescue_invalid_sql_query | |
239 | Query.any_instance.stubs(:statement).returns("INVALID STATEMENT") |
|
257 | Query.any_instance.stubs(:statement).returns("INVALID STATEMENT") | |
240 |
|
258 |
General Comments 0
You need to be logged in to leave comments.
Login now