summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-18 19:25:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-18 19:25:54 +0000
commit6f71a508eb9e9eb2655172e17a7799e011e9086f (patch)
tree2fef81bed9485bd56b585381d36bf3bf98b3b11b /test/functional
parent7366fb23bb9ad218f41af0fa820c80dc9b7a178f (diff)
downloadredmine-6f71a508eb9e9eb2655172e17a7799e011e9086f.tar.gz
redmine-6f71a508eb9e9eb2655172e17a7799e011e9086f.zip
Additional tests for CustomFieldsController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9437 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/custom_fields_controller_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index 42e57b91a..f86490156 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -37,6 +37,16 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_template 'index'
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
get :new, :type => 'IssueCustomField'
assert_response :success
@@ -135,4 +145,11 @@ class CustomFieldsControllerTest < ActionController::TestCase
assert_nil CustomField.find_by_id(1)
assert_nil CustomValue.find_by_custom_field_id(1)
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