summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-05 12:20:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-05 12:20:07 +0000
commit4cecc1beeda2337f50090d9fc0fe1d54fb8d54e2 (patch)
treeae525d4ae044a57c48e01462eb76e34e485ed6e3 /test/functional
parent51a1bf90dda6bc22b29b3801fbb7139b891376e5 (diff)
downloadredmine-4cecc1beeda2337f50090d9fc0fe1d54fb8d54e2.tar.gz
redmine-4cecc1beeda2337f50090d9fc0fe1d54fb8d54e2.zip
Ability to disable standard fields on a per tracker basis (#1091).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9912 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/trackers_controller_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/trackers_controller_test.rb b/test/functional/trackers_controller_test.rb
index 731d19b52..7393088ae 100644
--- a/test/functional/trackers_controller_test.rb
+++ b/test/functional/trackers_controller_test.rb
@@ -64,10 +64,21 @@ class TrackersControllerTest < ActionController::TestCase
tracker = Tracker.first(:order => 'id DESC')
assert_equal 'New tracker', tracker.name
assert_equal [1], tracker.project_ids.sort
+ assert_equal Tracker::CORE_FIELDS, tracker.core_fields
assert_equal [1, 6], tracker.custom_field_ids.sort
assert_equal 0, tracker.workflows.count
end
+ def create_with_disabled_core_fields
+ assert_difference 'Tracker.count' do
+ post :create, :tracker => { :name => 'New tracker', :core_fields => ['assigned_to_id', 'fixed_version_id', ''] }
+ end
+ assert_redirected_to :action => 'index'
+ tracker = Tracker.first(:order => 'id DESC')
+ assert_equal 'New tracker', tracker.name
+ assert_equal %w(assigned_to_id fixed_version_id), tracker.core_fields
+ end
+
def test_create_new_with_workflow_copy
assert_difference 'Tracker.count' do
post :create, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1
@@ -107,6 +118,24 @@ class TrackersControllerTest < ActionController::TestCase
:type => 'hidden'}
end
+ def test_edit_should_check_core_fields
+ tracker = Tracker.find(1)
+ tracker.core_fields = %w(assigned_to_id fixed_version_id)
+ tracker.save!
+
+ get :edit, :id => 1
+ assert_response :success
+ assert_template 'edit'
+
+ assert_select 'input[name=?][value=assigned_to_id][checked=checked]', 'tracker[core_fields][]'
+ assert_select 'input[name=?][value=fixed_version_id][checked=checked]', 'tracker[core_fields][]'
+
+ assert_select 'input[name=?][value=category_id]', 'tracker[core_fields][]'
+ assert_select 'input[name=?][value=category_id][checked=checked]', 'tracker[core_fields][]', 0
+
+ assert_select 'input[name=?][value=][type=hidden]', 'tracker[core_fields][]'
+ end
+
def test_update
put :update, :id => 1, :tracker => { :name => 'Renamed',
:project_ids => ['1', '2', ''] }
@@ -121,6 +150,12 @@ class TrackersControllerTest < ActionController::TestCase
assert Tracker.find(1).project_ids.empty?
end
+ def test_update_without_core_fields
+ put :update, :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 => '' }
assert_response :success