Commit fe11a9f3b635b44140e50613f91ac9f29bb8c170
1 parent
8337316e
Exists in
master
and in
28 other branches
ActionItem916: fixing tests
Showing
1 changed file
with
12 additions
and
12 deletions
Show diff stats
db/migrate/059_add_birth_date_to_person.rb
@@ -47,62 +47,62 @@ if $PROGRAM_NAME == __FILE__ | @@ -47,62 +47,62 @@ if $PROGRAM_NAME == __FILE__ | ||
47 | class ConvertDatesTest < Test::Unit::TestCase | 47 | class ConvertDatesTest < Test::Unit::TestCase |
48 | 48 | ||
49 | should 'convert with slash' do | 49 | should 'convert with slash' do |
50 | - date = ConvertDates.convert('10/01/2009') | 50 | + date = AddBirthDateToPerson::ConvertDates.convert('10/01/2009') |
51 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] | 51 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] |
52 | end | 52 | end |
53 | 53 | ||
54 | should 'convert with hyphen' do | 54 | should 'convert with hyphen' do |
55 | - date = ConvertDates.convert('10-01-2009') | 55 | + date = AddBirthDateToPerson::ConvertDates.convert('10-01-2009') |
56 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] | 56 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] |
57 | end | 57 | end |
58 | 58 | ||
59 | should 'convert with dot' do | 59 | should 'convert with dot' do |
60 | - date = ConvertDates.convert('10.01.2009') | 60 | + date = AddBirthDateToPerson::ConvertDates.convert('10.01.2009') |
61 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] | 61 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] |
62 | end | 62 | end |
63 | 63 | ||
64 | should 'convert with slash and space' do | 64 | should 'convert with slash and space' do |
65 | - date = ConvertDates.convert('10/ 01/ 2009') | 65 | + date = AddBirthDateToPerson::ConvertDates.convert('10/ 01/ 2009') |
66 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] | 66 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] |
67 | end | 67 | end |
68 | 68 | ||
69 | should 'convert with empty to nil' do | 69 | should 'convert with empty to nil' do |
70 | - date = ConvertDates.convert('') | 70 | + date = AddBirthDateToPerson::ConvertDates.convert('') |
71 | assert_nil date | 71 | assert_nil date |
72 | end | 72 | end |
73 | 73 | ||
74 | should 'convert with nil to nil' do | 74 | should 'convert with nil to nil' do |
75 | - date = ConvertDates.convert(nil) | 75 | + date = AddBirthDateToPerson::ConvertDates.convert(nil) |
76 | assert_nil date | 76 | assert_nil date |
77 | end | 77 | end |
78 | 78 | ||
79 | should 'convert with two digits 1900' do | 79 | should 'convert with two digits 1900' do |
80 | - date = ConvertDates.convert('10/01/99') | 80 | + date = AddBirthDateToPerson::ConvertDates.convert('10/01/99') |
81 | assert_equal [10, 1, 1999], [date.day, date.month, date.year] | 81 | assert_equal [10, 1, 1999], [date.day, date.month, date.year] |
82 | end | 82 | end |
83 | 83 | ||
84 | should 'convert with two digits 2000' do | 84 | should 'convert with two digits 2000' do |
85 | - date = ConvertDates.convert('10/01/09') | 85 | + date = AddBirthDateToPerson::ConvertDates.convert('10/01/09') |
86 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] | 86 | assert_equal [10, 1, 2009], [date.day, date.month, date.year] |
87 | end | 87 | end |
88 | 88 | ||
89 | should 'convert with two numbers' do | 89 | should 'convert with two numbers' do |
90 | - date = ConvertDates.convert('10/01') | 90 | + date = AddBirthDateToPerson::ConvertDates.convert('10/01') |
91 | assert_equal [10, 1, (Date.today.year - 100)], [date.day, date.month, date.year] | 91 | assert_equal [10, 1, (Date.today.year - 100)], [date.day, date.month, date.year] |
92 | end | 92 | end |
93 | 93 | ||
94 | should 'convert to nil if non-numeric date' do | 94 | should 'convert to nil if non-numeric date' do |
95 | - date = ConvertDates.convert('10 de agosto de 2009') | 95 | + date = AddBirthDateToPerson::ConvertDates.convert('10 de agosto de 2009') |
96 | assert_nil date | 96 | assert_nil date |
97 | end | 97 | end |
98 | 98 | ||
99 | should 'do nothing if date' do | 99 | should 'do nothing if date' do |
100 | - date = ConvertDates.convert(Date.today) | 100 | + date = AddBirthDateToPerson::ConvertDates.convert(Date.today) |
101 | assert_equal Date.today, date | 101 | assert_equal Date.today, date |
102 | end | 102 | end |
103 | 103 | ||
104 | should 'return nil when not string nor date' do | 104 | should 'return nil when not string nor date' do |
105 | - date = ConvertDates.convert(1001) | 105 | + date = AddBirthDateToPerson::ConvertDates.convert(1001) |
106 | assert_nil date | 106 | assert_nil date |
107 | end | 107 | end |
108 | 108 |