@@ -213,19 +213,13 class TimelogControllerTest < ActionController::TestCase | |||||
213 |
|
213 | |||
214 | def test_destroy_should_fail |
|
214 | def test_destroy_should_fail | |
215 | # simulate that this fails (e.g. due to a plugin), see #5700 |
|
215 | # simulate that this fails (e.g. due to a plugin), see #5700 | |
216 | TimeEntry.class_eval do |
|
216 | TimeEntry.any_instance.expects(:destroy).returns(false) | |
217 | before_destroy :stop_callback_chain |
|
|||
218 | def stop_callback_chain ; return false ; end |
|
|||
219 | end |
|
|||
220 |
|
217 | |||
221 | @request.session[:user_id] = 2 |
|
218 | @request.session[:user_id] = 2 | |
222 | delete :destroy, :id => 1 |
|
219 | delete :destroy, :id => 1 | |
223 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
220 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
224 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] |
|
221 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] | |
225 | assert_not_nil TimeEntry.find_by_id(1) |
|
222 | assert_not_nil TimeEntry.find_by_id(1) | |
226 |
|
||||
227 | # remove the simulation |
|
|||
228 | TimeEntry.before_destroy.reject! {|callback| callback.method == :stop_callback_chain } |
|
|||
229 | end |
|
223 | end | |
230 |
|
224 | |||
231 | def test_index_all_projects |
|
225 | def test_index_all_projects |
General Comments 0
You need to be logged in to leave comments.
Login now