@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -19,39 +19,39 require File.expand_path('../../test_helper', __FILE__) | |||
|
19 | 19 | |
|
20 | 20 | class CustomFieldTest < ActiveSupport::TestCase |
|
21 | 21 | fixtures :custom_fields |
|
22 | ||
|
22 | ||
|
23 | 23 | def test_create |
|
24 | 24 | field = UserCustomField.new(:name => 'Money money money', :field_format => 'float') |
|
25 | 25 | assert field.save |
|
26 | 26 | end |
|
27 | ||
|
27 | ||
|
28 | 28 | def test_regexp_validation |
|
29 | 29 | field = IssueCustomField.new(:name => 'regexp', :field_format => 'text', :regexp => '[a-z0-9') |
|
30 | 30 | assert !field.save |
|
31 | 31 | assert_equal I18n.t('activerecord.errors.messages.invalid'), field.errors.on(:regexp) |
|
32 | ||
|
32 | ||
|
33 | 33 | field.regexp = '[a-z0-9]' |
|
34 | 34 | assert field.save |
|
35 | 35 | end |
|
36 | ||
|
36 | ||
|
37 | 37 | def test_possible_values_should_accept_an_array |
|
38 | 38 | field = CustomField.new |
|
39 | 39 | field.possible_values = ["One value", ""] |
|
40 | 40 | assert_equal ["One value"], field.possible_values |
|
41 | 41 | end |
|
42 | ||
|
42 | ||
|
43 | 43 | def test_possible_values_should_accept_a_string |
|
44 | 44 | field = CustomField.new |
|
45 | 45 | field.possible_values = "One value" |
|
46 | 46 | assert_equal ["One value"], field.possible_values |
|
47 | 47 | end |
|
48 | ||
|
48 | ||
|
49 | 49 | def test_possible_values_should_accept_a_multiline_string |
|
50 | 50 | field = CustomField.new |
|
51 | 51 | field.possible_values = "One value\nAnd another one \r\n \n" |
|
52 | 52 | assert_equal ["One value", "And another one"], field.possible_values |
|
53 | 53 | end |
|
54 | ||
|
54 | ||
|
55 | 55 | def test_destroy |
|
56 | 56 | field = CustomField.find(1) |
|
57 | 57 | assert field.destroy |
General Comments 0
You need to be logged in to leave comments.
Login now