diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-08-07 16:58:51 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-08-07 16:58:51 +0000 |
commit | 599736aca7b9b5bd47d39fdf72c9fc1127730497 (patch) | |
tree | 1aabc950dccab01b701b45c43a13cee79b491fbe /test | |
parent | 1749fbf3e6169c7aa304c967ab4ff7ea4217e61e (diff) | |
download | redmine-599736aca7b9b5bd47d39fdf72c9fc1127730497.tar.gz redmine-599736aca7b9b5bd47d39fdf72c9fc1127730497.zip |
Update the new custom field form with remotely.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10163 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/custom_fields_controller_test.rb | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index 3e3506c1b..816a12b03 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.rb @@ -16,18 +16,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require File.expand_path('../../test_helper', __FILE__) -require 'custom_fields_controller' - -# Re-raise errors caught by the controller. -class CustomFieldsController; def rescue_action(e) raise e end; end class CustomFieldsControllerTest < ActionController::TestCase fixtures :custom_fields, :custom_values, :trackers, :users def setup - @controller = CustomFieldsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @request.session[:user_id] = 1 end @@ -43,7 +36,10 @@ class CustomFieldsControllerTest < ActionController::TestCase assert_response :success assert_template 'new' assert_kind_of klass, assigns(:custom_field) - assert_tag :select, :attributes => {:name => 'custom_field[field_format]'} + assert_select 'form#custom_field_form' do + assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]' + assert_select 'input[type=hidden][name=type][value=?]', klass.name + end end end @@ -51,22 +47,23 @@ class CustomFieldsControllerTest < ActionController::TestCase get :new, :type => 'IssueCustomField' assert_response :success assert_template 'new' - assert_tag :input, :attributes => {:name => 'custom_field[name]'} - assert_tag :select, - :attributes => {:name => 'custom_field[field_format]'}, - :child => { - :tag => 'option', - :attributes => {:value => 'user'}, - :content => 'User' - } - assert_tag :select, - :attributes => {:name => 'custom_field[field_format]'}, - :child => { - :tag => 'option', - :attributes => {:value => 'version'}, - :content => 'Version' - } - assert_tag :input, :attributes => {:name => 'type', :value => 'IssueCustomField'} + assert_select 'form#custom_field_form' do + assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]' do + assert_select 'option[value=user]', :text => 'User' + assert_select 'option[value=version]', :text => 'Version' + end + assert_select 'input[type=hidden][name=type][value=IssueCustomField]' + end + end + + def test_new_js + get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js' + assert_response :success + assert_template 'new' + assert_equal 'text/javascript', response.content_type + + field = assigns(:custom_field) + assert_equal 'list', field.field_format end def test_new_with_invalid_custom_field_class_should_render_404 |