summaryrefslogtreecommitdiffstats
path: root/test/functional/custom_fields_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-12-14 08:22:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-12-14 08:22:43 +0000
commit2e2e2cfe425c2664517fb59836fbd3eff5e35861 (patch)
treee3daa66ee8b36d2f1a1468ec9501fba5bc37d71c /test/functional/custom_fields_controller_test.rb
parentc74f6d9f9bcf02ccc480a2028802b83ec5d91aca (diff)
downloadredmine-2e2e2cfe425c2664517fb59836fbd3eff5e35861.tar.gz
redmine-2e2e2cfe425c2664517fb59836fbd3eff5e35861.zip
Merged custom fields format refactoring.
git-svn-id: http://svn.redmine.org/redmine/trunk@12400 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/custom_fields_controller_test.rb')
-rw-r--r--test/functional/custom_fields_controller_test.rb29
1 files changed, 20 insertions, 9 deletions
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index 1a91fc306..5e6833ece 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -30,19 +30,28 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_template 'index'
end
- def test_new
+ def test_new_should_work_for_each_customized_class_and_format
custom_field_classes.each do |klass|
- get :new, :type => klass.name
- assert_response :success
- assert_template 'new'
- assert_kind_of klass, assigns(:custom_field)
- assert_select 'form#custom_field_form' do
- assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]'
- assert_select 'input[type=hidden][name=type][value=?]', klass.name
+ Redmine::FieldFormat.available_formats.each do |format_name|
+ get :new, :type => klass.name, :custom_field => {:field_format => format_name}
+ assert_response :success
+ assert_template 'new'
+ assert_kind_of klass, assigns(:custom_field)
+ assert_equal format_name, assigns(:custom_field).format.name
+ assert_select 'form#custom_field_form' do
+ assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]'
+ assert_select 'input[type=hidden][name=type][value=?]', klass.name
+ end
end
end
end
+ def test_new_should_have_string_default_format
+ get :new, :type => 'IssueCustomField'
+ assert_response :success
+ assert_equal 'string', assigns(:custom_field).format.name
+ end
+
def test_new_issue_custom_field
get :new, :type => 'IssueCustomField'
assert_response :success
@@ -83,7 +92,9 @@ class CustomFieldsControllerTest < ActionController::TestCase
def test_default_value_should_be_a_checkbox_for_bool_custom_field
get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'bool'}
assert_response :success
- assert_select 'input[name=?][type=checkbox]', 'custom_field[default_value]'
+ assert_select 'select[name=?]', 'custom_field[default_value]' do
+ assert_select 'option', 3
+ end
end
def test_default_value_should_not_be_present_for_user_custom_field