summaryrefslogtreecommitdiffstats
path: root/test/functional/custom_fields_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-10-20 08:29:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-10-20 08:29:55 +0000
commit13e381d31de0055905bd95813fc8034582b2dedc (patch)
tree1354c6ec8032935df3bc21c92a7821a7fbef03df /test/functional/custom_fields_controller_test.rb
parent4eea64d38fd813d8f0edf87efe59ed7d3826d29c (diff)
downloadredmine-13e381d31de0055905bd95813fc8034582b2dedc.tar.gz
redmine-13e381d31de0055905bd95813fc8034582b2dedc.zip
Projects selection on custom field form (#15136).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12225 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/custom_fields_controller_test.rb')
-rw-r--r--test/functional/custom_fields_controller_test.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index c7efcfeb6..1a91fc306 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -18,7 +18,7 @@
require File.expand_path('../../test_helper', __FILE__)
class CustomFieldsControllerTest < ActionController::TestCase
- fixtures :custom_fields, :custom_values, :trackers, :users
+ fixtures :custom_fields, :custom_values, :trackers, :users, :projects
def setup
@request.session[:user_id] = 1
@@ -52,10 +52,22 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_select 'option[value=user]', :text => 'User'
assert_select 'option[value=version]', :text => 'Version'
end
+ assert_select 'input[type=checkbox][name=?]', 'custom_field[project_ids][]', Project.count
+ assert_select 'input[type=hidden][name=?]', 'custom_field[project_ids][]', 1
assert_select 'input[type=hidden][name=type][value=IssueCustomField]'
end
end
+ def test_new_time_entry_custom_field_should_not_show_trackers_and_projects
+ get :new, :type => 'TimeEntryCustomField'
+ assert_response :success
+ assert_template 'new'
+ assert_select 'form#custom_field_form' do
+ assert_select 'input[name=?]', 'custom_field[tracker_ids][]', 0
+ assert_select 'input[name=?]', 'custom_field[project_ids][]', 0
+ end
+ end
+
def test_default_value_should_be_an_input_for_string_custom_field
get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'string'}
assert_response :success
@@ -118,6 +130,17 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_equal 1, field.trackers.size
end
+ def test_create_with_project_ids
+ assert_difference 'CustomField.count' do
+ post :create, :type => "IssueCustomField", :custom_field => {
+ :name => "foo", :field_format => "string", :is_for_all => "0", :project_ids => ["1", "3", ""]
+ }
+ assert_response 302
+ end
+ field = IssueCustomField.order("id desc").first
+ assert_equal [1, 3], field.projects.map(&:id).sort
+ end
+
def test_create_with_failure
assert_no_difference 'CustomField.count' do
post :create, :type => "IssueCustomField", :custom_field => {:name => ''}