mirror of
https://github.com/redmine/redmine.git
synced 2025-11-01 19:05:51 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user