summaryrefslogtreecommitdiffstats
path: root/test/functional/trackers_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-16 07:43:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-16 07:43:16 +0000
commit6cc6a918b4f36dbad445a5756f174b767e4ad61b (patch)
tree87704465c1a28284c466744eb6418cbd8adb1e22 /test/functional/trackers_controller_test.rb
parent11c85279ab2a8e660666e2c0c80025e2e2513940 (diff)
downloadredmine-6cc6a918b4f36dbad445a5756f174b767e4ad61b.tar.gz
redmine-6cc6a918b4f36dbad445a5756f174b767e4ad61b.zip
Pass parameters with :params in controller tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15666 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/trackers_controller_test.rb')
-rw-r--r--test/functional/trackers_controller_test.rb80
1 files changed, 61 insertions, 19 deletions
diff --git a/test/functional/trackers_controller_test.rb b/test/functional/trackers_controller_test.rb
index 72467c8d0..d7342b495 100644
--- a/test/functional/trackers_controller_test.rb
+++ b/test/functional/trackers_controller_test.rb
@@ -51,7 +51,14 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_create
assert_difference 'Tracker.count' do
- post :create, :tracker => { :name => 'New tracker', :default_status_id => 1, :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] }
+ post :create, :params => {
+ :tracker => {
+ :name => 'New tracker',
+ :default_status_id => 1,
+ :project_ids => ['1', '', ''],
+ :custom_field_ids => ['1', '6', '']
+ }
+ }
end
assert_redirected_to :action => 'index'
tracker = Tracker.order('id DESC').first
@@ -64,7 +71,13 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_create_with_disabled_core_fields
assert_difference 'Tracker.count' do
- post :create, :tracker => { :name => 'New tracker', :default_status_id => 1, :core_fields => ['assigned_to_id', 'fixed_version_id', ''] }
+ post :create, :params => {
+ :tracker => {
+ :name => 'New tracker',
+ :default_status_id => 1,
+ :core_fields => ['assigned_to_id', 'fixed_version_id', '']
+ }
+ }
end
assert_redirected_to :action => 'index'
tracker = Tracker.order('id DESC').first
@@ -74,7 +87,13 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_create_new_with_workflow_copy
assert_difference 'Tracker.count' do
- post :create, :tracker => { :name => 'New tracker', :default_status_id => 1 }, :copy_workflow_from => 1
+ post :create, :params => {
+ :tracker => {
+ :name => 'New tracker',
+ :default_status_id => 1
+ },
+ :copy_workflow_from => 1
+ }
end
assert_redirected_to :action => 'index'
tracker = Tracker.find_by_name('New tracker')
@@ -84,8 +103,13 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'Tracker.count' do
- post :create, :tracker => { :name => '', :project_ids => ['1', '', ''],
- :custom_field_ids => ['1', '6', ''] }
+ post :create, :params => {
+ :tracker => {
+ :name => '',
+ :project_ids => ['1', '', ''],
+ :custom_field_ids => ['1', '6', '']
+ }
+ }
end
assert_response :success
assert_template 'new'
@@ -95,7 +119,7 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_edit
Tracker.find(1).project_ids = [1, 3]
- get :edit, :id => 1
+ get :edit, :params => {:id => 1}
assert_response :success
assert_template 'edit'
@@ -110,7 +134,7 @@ class TrackersControllerTest < Redmine::ControllerTest
tracker.core_fields = %w(assigned_to_id fixed_version_id)
tracker.save!
- get :edit, :id => 1
+ get :edit, :params => {:id => 1}
assert_response :success
assert_template 'edit'
@@ -124,27 +148,43 @@ class TrackersControllerTest < Redmine::ControllerTest
end
def test_update
- put :update, :id => 1, :tracker => { :name => 'Renamed',
- :project_ids => ['1', '2', ''] }
+ put :update, :params => {
+ :id => 1,
+ :tracker => {
+ :name => 'Renamed',
+ :project_ids => ['1', '2', '']
+ }
+ }
assert_redirected_to :action => 'index'
assert_equal [1, 2], Tracker.find(1).project_ids.sort
end
def test_update_without_projects
- put :update, :id => 1, :tracker => { :name => 'Renamed',
- :project_ids => [''] }
+ put :update, :params => {
+ :id => 1,
+ :tracker => {
+ :name => 'Renamed',
+ :project_ids => ['']
+ }
+ }
assert_redirected_to :action => 'index'
assert Tracker.find(1).project_ids.empty?
end
def test_update_without_core_fields
- put :update, :id => 1, :tracker => { :name => 'Renamed', :core_fields => [''] }
+ put :update, :params => {
+ :id => 1,
+ :tracker => {
+ :name => 'Renamed',
+ :core_fields => ['']
+ }
+ }
assert_redirected_to :action => 'index'
assert Tracker.find(1).core_fields.empty?
end
def test_update_with_failure
- put :update, :id => 1, :tracker => { :name => '' }
+ put :update, :params => {:id => 1, :tracker => { :name => '' }}
assert_response :success
assert_template 'edit'
assert_select_error /name cannot be blank/i
@@ -152,14 +192,14 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_move_lower
tracker = Tracker.find_by_position(1)
- put :update, :id => 1, :tracker => { :position => '2' }
+ put :update, :params => {:id => 1, :tracker => { :position => '2' }}
assert_equal 2, tracker.reload.position
end
def test_destroy
tracker = Tracker.generate!(:name => 'Destroyable')
assert_difference 'Tracker.count', -1 do
- delete :destroy, :id => tracker.id
+ delete :destroy, :params => {:id => tracker.id}
end
assert_redirected_to :action => 'index'
assert_nil flash[:error]
@@ -167,7 +207,7 @@ class TrackersControllerTest < Redmine::ControllerTest
def test_destroy_tracker_in_use
assert_no_difference 'Tracker.count' do
- delete :destroy, :id => 1
+ delete :destroy, :params => {:id => 1}
end
assert_redirected_to :action => 'index'
assert_not_nil flash[:error]
@@ -188,9 +228,11 @@ class TrackersControllerTest < Redmine::ControllerTest
end
def test_post_fields
- post :fields, :trackers => {
- '1' => {'core_fields' => ['assigned_to_id', 'due_date', ''], 'custom_field_ids' => ['1', '2']},
- '2' => {'core_fields' => [''], 'custom_field_ids' => ['']}
+ post :fields, :params => {
+ :trackers => {
+ '1' => {'core_fields' => ['assigned_to_id', 'due_date', ''], 'custom_field_ids' => ['1', '2']},
+ '2' => {'core_fields' => [''], 'custom_field_ids' => ['']}
+ }
}
assert_redirected_to '/trackers/fields'