--- /dev/null
+# Redmine - project management software\r
+# Copyright (C) 2006-2009 Jean-Philippe Lang\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+# \r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+# \r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+\r
+require File.dirname(__FILE__) + '/../test_helper'\r
+require 'custom_fields_controller'\r
+\r
+# Re-raise errors caught by the controller.\r
+class CustomFieldsController; def rescue_action(e) raise e end; end\r
+\r
+class CustomFieldsControllerTest < Test::Unit::TestCase\r
+ fixtures :custom_fields, :trackers\r
+ \r
+ def setup\r
+ @controller = CustomFieldsController.new\r
+ @request = ActionController::TestRequest.new\r
+ @response = ActionController::TestResponse.new\r
+ @request.session[:user_id] = 1\r
+ end\r
+ \r
+ def test_post_new_list_custom_field\r
+ assert_difference 'CustomField.count' do\r
+ post :new, :type => "IssueCustomField",\r
+ :tracker_ids => ["1"],\r
+ :custom_field => {:name => "test_post_new_list",\r
+ :default_value => "",\r
+ :min_length => "0",\r
+ :searchable => "0",\r
+ :regexp => "",\r
+ :is_for_all => "1",\r
+ :possible_values => "0.1\n0.2\n",\r
+ :max_length => "0",\r
+ :is_filter => "0",\r
+ :is_required =>"0",\r
+ :field_format => "list"}\r
+ end \r
+ assert_redirected_to '/custom_fields/list'\r
+ field = IssueCustomField.find_by_name('test_post_new_list')\r
+ assert_not_nil field\r
+ assert_equal ["0.1", "0.2"], field.possible_values\r
+ assert_equal 1, field.trackers.size\r
+ end\r
+end\r