@@ -0,0 +1,56 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2009 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
|
19 | require 'custom_fields_controller' | |
|
20 | ||
|
21 | # Re-raise errors caught by the controller. | |
|
22 | class CustomFieldsController; def rescue_action(e) raise e end; end | |
|
23 | ||
|
24 | class CustomFieldsControllerTest < Test::Unit::TestCase | |
|
25 | fixtures :custom_fields, :trackers | |
|
26 | ||
|
27 | def setup | |
|
28 | @controller = CustomFieldsController.new | |
|
29 | @request = ActionController::TestRequest.new | |
|
30 | @response = ActionController::TestResponse.new | |
|
31 | @request.session[:user_id] = 1 | |
|
32 | end | |
|
33 | ||
|
34 | def test_post_new_list_custom_field | |
|
35 | assert_difference 'CustomField.count' do | |
|
36 | post :new, :type => "IssueCustomField", | |
|
37 | :tracker_ids => ["1"], | |
|
38 | :custom_field => {:name => "test_post_new_list", | |
|
39 | :default_value => "", | |
|
40 | :min_length => "0", | |
|
41 | :searchable => "0", | |
|
42 | :regexp => "", | |
|
43 | :is_for_all => "1", | |
|
44 | :possible_values => "0.1\n0.2\n", | |
|
45 | :max_length => "0", | |
|
46 | :is_filter => "0", | |
|
47 | :is_required =>"0", | |
|
48 | :field_format => "list"} | |
|
49 | end | |
|
50 | assert_redirected_to '/custom_fields/list' | |
|
51 | field = IssueCustomField.find_by_name('test_post_new_list') | |
|
52 | assert_not_nil field | |
|
53 | assert_equal ["0.1", "0.2"], field.possible_values | |
|
54 | assert_equal 1, field.trackers.size | |
|
55 | end | |
|
56 | end |
General Comments 0
You need to be logged in to leave comments.
Login now