Mercurial > hg > soundsoftware-site
diff test/functional/custom_fields_controller_test.rb @ 511:107d36338b70 live
Merge from branch "cannam"
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:43:07 +0100 |
parents | cbce1fd3b1b7 |
children | cbb26bc654de |
line wrap: on
line diff
--- a/test/functional/custom_fields_controller_test.rb Thu Jun 09 16:51:06 2011 +0100 +++ b/test/functional/custom_fields_controller_test.rb Thu Jul 14 10:43:07 2011 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2009 Jean-Philippe Lang +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require File.dirname(__FILE__) + '/../test_helper' +require File.expand_path('../../test_helper', __FILE__) require 'custom_fields_controller' # Re-raise errors caught by the controller. @@ -31,6 +31,31 @@ @request.session[:user_id] = 1 end + def test_get_new_issue_custom_field + get :new, :type => 'IssueCustomField' + assert_response :success + assert_template 'new' + 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' + } + end + + def test_get_new_with_invalid_custom_field_class_should_redirect_to_list + get :new, :type => 'UnknownCustomField' + assert_redirected_to '/custom_fields' + end + def test_post_new_list_custom_field assert_difference 'CustomField.count' do post :new, :type => "IssueCustomField", @@ -53,9 +78,4 @@ assert_equal ["0.1", "0.2"], field.possible_values assert_equal 1, field.trackers.size end - - def test_invalid_custom_field_class_should_redirect_to_list - get :new, :type => 'UnknownCustomField' - assert_redirected_to '/custom_fields' - end end