File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ class Entity < ModelPart
25
25
'city' ,
26
26
'country' ,
27
27
'email' ,
28
+ 'date-end' ,
29
+ 'date-start' ,
28
30
'fax' ,
29
31
'location' ,
30
32
'name' ,
@@ -48,5 +50,31 @@ def initialize(param)
48
50
end
49
51
end
50
52
53
+ # :call-seq:
54
+ # date_end = date
55
+ #
56
+ # Set the `date-end` field. If a non-Date object is passed in it will
57
+ # be parsed into a Date.
58
+ def date_end = ( date )
59
+ unless Date === date
60
+ date = Date . parse ( date )
61
+ end
62
+
63
+ @fields [ 'date-end' ] = date
64
+ end
65
+
66
+ # :call-seq:
67
+ # date_start = date
68
+ #
69
+ # Set the `date-start` field. If a non-Date object is passed in it will
70
+ # be parsed into a Date.
71
+ def date_start = ( date )
72
+ unless Date === date
73
+ date = Date . parse ( date )
74
+ end
75
+
76
+ @fields [ 'date-start' ] = date
77
+ end
78
+
51
79
end
52
80
end
Original file line number Diff line number Diff line change @@ -57,6 +57,20 @@ def test_simple_fields_set_and_output_correctly
57
57
end
58
58
end
59
59
60
+ def test_date_fields_set_and_output_correctly
61
+ date = Date . today
62
+ @entity . date_end = date
63
+ @entity . date_start = date
64
+
65
+ assert_equal @entity . date_end , date
66
+ assert_equal @entity . date_start , date
67
+
68
+ y = @entity . fields . to_yaml
69
+
70
+ assert y . include? "date-end: #{ date . to_s } \n "
71
+ assert y . include? "date-start: #{ date . to_s } \n "
72
+ end
73
+
60
74
def test_tel_fax_fields_set_and_output_correctly
61
75
number = "+44 (0) 161-234-5678"
62
76
@entity . fax = number
You can’t perform that action at this time.
0 commit comments