To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / test / unit / .svn / text-base / custom_field_test.rb.svn-base @ 441:cbce1fd3b1b7
History | View | Annotate | Download (1.72 KB)
| 1 |
# redMine - project management software |
|---|---|
| 2 |
# Copyright (C) 2006-2007 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.expand_path('../../test_helper', __FILE__)
|
| 19 |
|
| 20 |
class CustomFieldTest < ActiveSupport::TestCase |
| 21 |
fixtures :custom_fields |
| 22 |
|
| 23 |
def test_create |
| 24 |
field = UserCustomField.new(:name => 'Money money money', :field_format => 'float') |
| 25 |
assert field.save |
| 26 |
end |
| 27 |
|
| 28 |
def test_possible_values_should_accept_an_array |
| 29 |
field = CustomField.new |
| 30 |
field.possible_values = ["One value", ""] |
| 31 |
assert_equal ["One value"], field.possible_values |
| 32 |
end |
| 33 |
|
| 34 |
def test_possible_values_should_accept_a_string |
| 35 |
field = CustomField.new |
| 36 |
field.possible_values = "One value" |
| 37 |
assert_equal ["One value"], field.possible_values |
| 38 |
end |
| 39 |
|
| 40 |
def test_possible_values_should_accept_a_multiline_string |
| 41 |
field = CustomField.new |
| 42 |
field.possible_values = "One value\nAnd another one \r\n \n" |
| 43 |
assert_equal ["One value", "And another one"], field.possible_values |
| 44 |
end |
| 45 |
|
| 46 |
def test_destroy |
| 47 |
field = CustomField.find(1) |
| 48 |
assert field.destroy |
| 49 |
end |
| 50 |
end |