diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-05-31 17:32:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-05-31 17:32:34 +0000 |
commit | b834e81d7f41121fc6d9bef95ee090f8f466493e (patch) | |
tree | 61fddb6214c64e96fddd504301029bdb382ba439 /test/functional/imports_controller_test.rb | |
parent | 1d4300b674f739d671a8be22d3ea617922f16517 (diff) | |
download | redmine-b834e81d7f41121fc6d9bef95ee090f8f466493e.tar.gz redmine-b834e81d7f41121fc6d9bef95ee090f8f466493e.zip |
Use Rails 5 syntax for functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@16585 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/imports_controller_test.rb')
-rw-r--r-- | test/functional/imports_controller_test.rb | 88 |
1 files changed, 69 insertions, 19 deletions
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb index 28ce703f5..ef9ab0c89 100644 --- a/test/functional/imports_controller_test.rb +++ b/test/functional/imports_controller_test.rb @@ -49,7 +49,9 @@ class ImportsControllerTest < Redmine::ControllerTest def test_create_should_save_the_file import = new_record(Import) do - post :create, :file => uploaded_test_file('import_issues.csv', 'text/csv') + post :create, :params => { + :file => uploaded_test_file('import_issues.csv', 'text/csv') + } assert_response 302 end assert_equal 2, import.user_id @@ -59,7 +61,9 @@ class ImportsControllerTest < Redmine::ControllerTest def test_get_settings_should_display_settings_form import = generate_import - get :settings, :id => import.to_param + get :settings, :params => { + :id => import.to_param + } assert_response :success assert_select 'select[name=?]', 'import_settings[separator]' assert_select 'select[name=?]', 'import_settings[wrapper]' @@ -70,8 +74,15 @@ class ImportsControllerTest < Redmine::ControllerTest def test_post_settings_should_update_settings import = generate_import - post :settings, :id => import.to_param, - :import_settings => {:separator => ":", :wrapper => "|", :encoding => "UTF-8", :date_format => '%m/%d/%Y'} + post :settings, :params => { + :id => import.to_param, + :import_settings => { + :separator => ":", + :wrapper => "|", + :encoding => "UTF-8", + :date_format => '%m/%d/%Y' + } + } assert_redirected_to "/imports/#{import.to_param}/mapping" import.reload @@ -84,8 +95,14 @@ class ImportsControllerTest < Redmine::ControllerTest def test_post_settings_should_update_total_items_count import = generate_import('import_iso8859-1.csv') - post :settings, :id => import.to_param, - :import_settings => {:separator => ";", :wrapper => '"', :encoding => "ISO-8859-1"} + post :settings, :params => { + :id => import.to_param, + :import_settings => { + :separator => ";", + :wrapper => '"', + :encoding => "ISO-8859-1" + } + } assert_response 302 import.reload assert_equal 2, import.total_items @@ -94,8 +111,14 @@ class ImportsControllerTest < Redmine::ControllerTest def test_post_settings_with_wrong_encoding_should_display_error import = generate_import('import_iso8859-1.csv') - post :settings, :id => import.to_param, - :import_settings => {:separator => ";", :wrapper => '"', :encoding => "UTF-8"} + post :settings, :params => { + :id => import.to_param, + :import_settings => { + :separator => ";", + :wrapper => '"', + :encoding => "UTF-8" + } + } assert_response 200 import.reload assert_nil import.total_items @@ -105,8 +128,14 @@ class ImportsControllerTest < Redmine::ControllerTest def test_post_settings_with_invalid_encoding_should_display_error import = generate_import('invalid-Shift_JIS.csv') - post :settings, :id => import.to_param, - :import_settings => {:separator => ";", :wrapper => '"', :encoding => "Shift_JIS"} + post :settings, :params => { + :id => import.to_param, + :import_settings => { + :separator => ";", + :wrapper => '"', + :encoding => "Shift_JIS" + } + } assert_response 200 import.reload assert_nil import.total_items @@ -118,7 +147,9 @@ class ImportsControllerTest < Redmine::ControllerTest import.settings = {'separator' => ";", 'wrapper' => '"', 'encoding' => "ISO-8859-1"} import.save! - get :mapping, :id => import.to_param + get :mapping, :params => { + :id => import.to_param + } assert_response :success assert_select 'select[name=?]', 'import_settings[mapping][subject]' do @@ -135,8 +166,15 @@ class ImportsControllerTest < Redmine::ControllerTest def test_post_mapping_should_update_mapping import = generate_import('import_iso8859-1.csv') - post :mapping, :id => import.to_param, - :import_settings => {:mapping => {:project_id => '1', :tracker_id => '2', :subject => '0'}} + post :mapping, :params => { + :id => import.to_param, + :import_settings => { + :mapping => { + :project_id => '1', + :tracker_id => '2', + :subject => '0'} + } + } assert_redirected_to "/imports/#{import.to_param}/run" import.reload mapping = import.settings['mapping'] @@ -149,7 +187,9 @@ class ImportsControllerTest < Redmine::ControllerTest def test_get_run import = generate_import_with_mapping - get :run, :id => import + get :run, :params => { + :id => import + } assert_response :success assert_select '#import-progress' end @@ -158,7 +198,9 @@ class ImportsControllerTest < Redmine::ControllerTest import = generate_import_with_mapping assert_difference 'Issue.count', 3 do - post :run, :id => import + post :run, :params => { + :id => import + } assert_redirected_to "/imports/#{import.to_param}" end @@ -175,12 +217,16 @@ class ImportsControllerTest < Redmine::ControllerTest import = generate_import_with_mapping assert_difference 'Issue.count', 2 do - post :run, :id => import + post :run, :params => { + :id => import + } assert_redirected_to "/imports/#{import.to_param}/run" end assert_difference 'Issue.count', 1 do - post :run, :id => import + post :run, :params => { + :id => import + } assert_redirected_to "/imports/#{import.to_param}" end @@ -193,7 +239,9 @@ class ImportsControllerTest < Redmine::ControllerTest import.run assert_equal 0, import.unsaved_items.count - get :show, :id => import.to_param + get :show, :params => { + :id => import.to_param + } assert_response :success assert_select 'ul#saved-items' @@ -207,7 +255,9 @@ class ImportsControllerTest < Redmine::ControllerTest import.run assert_not_equal 0, import.unsaved_items.count - get :show, :id => import.to_param + get :show, :params => { + :id => import.to_param + } assert_response :success assert_select 'table#unsaved-items' |