File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ def to_time
84
84
# time formats and is only used when ActiveSupport is available.
85
85
#
86
86
def to_s ( format = nil )
87
- if format && to_time . public_method ( :to_s ) . arity > 0
87
+ if format && to_time . public_method ( :to_s ) . arity != 0
88
88
t0 , t1 = start_time . to_s ( format ) , end_time . to_s ( format )
89
89
else
90
90
t0 , t1 = start_time . to_s , end_time . to_s
Original file line number Diff line number Diff line change 28
28
end
29
29
30
30
it "accepts a format option to comply with ActiveSupport" do
31
- occurrence = Occurrence . new ( Time . now )
31
+ require 'active_support/core_ext/time'
32
+ time_now = Time . current
33
+ occurrence = Occurrence . new ( time_now )
32
34
33
- expect { occurrence . to_s ( :short ) } . not_to raise_error
35
+ expect ( occurrence . to_s ( :short ) ) . to eq time_now . to_s ( :short )
34
36
end
35
37
end
36
38
You can’t perform that action at this time.
0 commit comments