diff options
Diffstat (limited to 'test/functional/enumerations_controller_test.rb')
-rw-r--r-- | test/functional/enumerations_controller_test.rb | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb index b44f3f4d1..1e4dca2f8 100644 --- a/test/functional/enumerations_controller_test.rb +++ b/test/functional/enumerations_controller_test.rb @@ -37,7 +37,9 @@ class EnumerationsControllerTest < Redmine::ControllerTest end def test_new - get :new, :type => 'IssuePriority' + get :new, :params => { + :type => 'IssuePriority' + } assert_response :success assert_select 'input[name=?][value=?]', 'enumeration[type]', 'IssuePriority' @@ -45,13 +47,20 @@ class EnumerationsControllerTest < Redmine::ControllerTest end def test_new_with_invalid_type_should_respond_with_404 - get :new, :type => 'UnknownType' + get :new, :params => { + :type => 'UnknownType' + } assert_response 404 end def test_create assert_difference 'IssuePriority.count' do - post :create, :enumeration => {:type => 'IssuePriority', :name => 'Lowest'} + post :create, :params => { + :enumeration => { + :type => 'IssuePriority', + :name => 'Lowest' + } + } end assert_redirected_to '/enumerations' e = IssuePriority.find_by_name('Lowest') @@ -60,26 +69,41 @@ class EnumerationsControllerTest < Redmine::ControllerTest def test_create_with_failure assert_no_difference 'IssuePriority.count' do - post :create, :enumeration => {:type => 'IssuePriority', :name => ''} + post :create, :params => { + :enumeration => { + :type => 'IssuePriority', + :name => '' + } + } end assert_response :success assert_select_error /name cannot be blank/i end def test_edit - get :edit, :id => 6 + get :edit, :params => { + :id => 6 + } assert_response :success assert_select 'input[name=?][value=?]', 'enumeration[name]', 'High' end def test_edit_invalid_should_respond_with_404 - get :edit, :id => 999 + get :edit, :params => { + :id => 999 + } assert_response 404 end def test_update assert_no_difference 'IssuePriority.count' do - put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => 'New name'} + put :update, :params => { + :id => 6, + :enumeration => { + :type => 'IssuePriority', + :name => 'New name' + } + } end assert_redirected_to '/enumerations' e = IssuePriority.find(6) @@ -88,7 +112,13 @@ class EnumerationsControllerTest < Redmine::ControllerTest def test_update_with_failure assert_no_difference 'IssuePriority.count' do - put :update, :id => 6, :enumeration => {:type => 'IssuePriority', :name => ''} + put :update, :params => { + :id => 6, + :enumeration => { + :type => 'IssuePriority', + :name => '' + } + } end assert_response :success assert_select_error /name cannot be blank/i @@ -96,7 +126,9 @@ class EnumerationsControllerTest < Redmine::ControllerTest def test_destroy_enumeration_not_in_use assert_difference 'IssuePriority.count', -1 do - delete :destroy, :id => 7 + delete :destroy, :params => { + :id => 7 + } end assert_redirected_to :controller => 'enumerations', :action => 'index' assert_nil Enumeration.find_by_id(7) @@ -104,7 +136,9 @@ class EnumerationsControllerTest < Redmine::ControllerTest def test_destroy_enumeration_in_use assert_no_difference 'IssuePriority.count' do - delete :destroy, :id => 4 + delete :destroy, :params => { + :id => 4 + } end assert_response :success @@ -117,7 +151,10 @@ class EnumerationsControllerTest < Redmine::ControllerTest def test_destroy_enumeration_in_use_with_reassignment issue = Issue.where(:priority_id => 4).first assert_difference 'IssuePriority.count', -1 do - delete :destroy, :id => 4, :reassign_to_id => 6 + delete :destroy, :params => { + :id => 4, + :reassign_to_id => 6 + } end assert_redirected_to :controller => 'enumerations', :action => 'index' assert_nil Enumeration.find_by_id(4) @@ -127,7 +164,10 @@ class EnumerationsControllerTest < Redmine::ControllerTest def test_destroy_enumeration_in_use_with_blank_reassignment assert_no_difference 'IssuePriority.count' do - delete :destroy, :id => 4, :reassign_to_id => '' + delete :destroy, :params => { + :id => 4, + :reassign_to_id => '' + } end assert_response :success end |