Additional tests for CustomFieldsController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9437 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7366fb23bb
commit
6f71a508eb
|
@ -37,6 +37,16 @@ class CustomFieldsControllerTest < ActionController::TestCase
|
||||||
assert_template 'index'
|
assert_template 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_new
|
||||||
|
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_tag :select, :attributes => {:name => 'custom_field[field_format]'}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_new_issue_custom_field
|
def test_new_issue_custom_field
|
||||||
get :new, :type => 'IssueCustomField'
|
get :new, :type => 'IssueCustomField'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -135,4 +145,11 @@ class CustomFieldsControllerTest < ActionController::TestCase
|
||||||
assert_nil CustomField.find_by_id(1)
|
assert_nil CustomField.find_by_id(1)
|
||||||
assert_nil CustomValue.find_by_custom_field_id(1)
|
assert_nil CustomValue.find_by_custom_field_id(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def custom_field_classes
|
||||||
|
files = Dir.glob(File.join(Rails.root, 'app/models/*_custom_field.rb')).map {|f| File.basename(f).sub(/\.rb$/, '') }
|
||||||
|
classes = files.map(&:classify).map(&:constantize)
|
||||||
|
assert classes.size > 0
|
||||||
|
classes
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue