##// END OF EJS Templates
Additional tests for CustomFieldsController....
Jean-Philippe Lang -
r9303:6f71a508eb9e
parent child
Show More
@@ -37,6 +37,16 class CustomFieldsControllerTest < ActionController::TestCase
37 assert_template 'index'
37 assert_template 'index'
38 end
38 end
39
39
40 def test_new
41 custom_field_classes.each do |klass|
42 get :new, :type => klass.name
43 assert_response :success
44 assert_template 'new'
45 assert_kind_of klass, assigns(:custom_field)
46 assert_tag :select, :attributes => {:name => 'custom_field[field_format]'}
47 end
48 end
49
40 def test_new_issue_custom_field
50 def test_new_issue_custom_field
41 get :new, :type => 'IssueCustomField'
51 get :new, :type => 'IssueCustomField'
42 assert_response :success
52 assert_response :success
@@ -135,4 +145,11 class CustomFieldsControllerTest < ActionController::TestCase
135 assert_nil CustomField.find_by_id(1)
145 assert_nil CustomField.find_by_id(1)
136 assert_nil CustomValue.find_by_custom_field_id(1)
146 assert_nil CustomValue.find_by_custom_field_id(1)
137 end
147 end
148
149 def custom_field_classes
150 files = Dir.glob(File.join(Rails.root, 'app/models/*_custom_field.rb')).map {|f| File.basename(f).sub(/\.rb$/, '') }
151 classes = files.map(&:classify).map(&:constantize)
152 assert classes.size > 0
153 classes
154 end
138 end
155 end
General Comments 0
You need to be logged in to leave comments. Login now