Show tabs for existing custom field types only and adds a view for choosing the type when adding a new custom field.

git-svn-id: http://svn.redmine.org/redmine/trunk@12849 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-02-07 07:57:59 +00:00
parent 09b95905dc
commit 7b127ee489
10 changed files with 59 additions and 12 deletions

View File

@@ -30,6 +30,14 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_template 'index'
end
def test_new_without_type_should_render_select_type
get :new
assert_response :success
assert_template 'select_type'
assert_select 'input[name=type]', CustomField.subclasses.size
assert_select 'input[name=type][checked=checked]', 1
end
def test_new_should_work_for_each_customized_class_and_format
custom_field_classes.each do |klass|
Redmine::FieldFormat.available_formats.each do |format_name|
@@ -113,9 +121,10 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_equal 'list', field.field_format
end
def test_new_with_invalid_custom_field_class_should_render_404
def test_new_with_invalid_custom_field_class_should_render_select_type
get :new, :type => 'UnknownCustomField'
assert_response 404
assert_response :success
assert_template 'select_type'
end
def test_create_list_custom_field
@@ -160,6 +169,14 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_template 'new'
end
def test_create_without_type_should_render_select_type
assert_no_difference 'CustomField.count' do
post :create, :custom_field => {:name => ''}
end
assert_response :success
assert_template 'select_type'
end
def test_edit
get :edit, :id => 1
assert_response :success