Skip to content

Commit

Permalink
Merge pull request ice-cube-ruby#48 from flavorpill/master
Browse files Browse the repository at this point in the history
Schedule#to_s does not work when an end_time is set
  • Loading branch information
seejohnrun committed Dec 14, 2011
2 parents 7238de6 + 105a70c commit c8c542c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ice_cube/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def to_s
pieces.concat rrules.map { |t| t.to_s }
pieces.concat exrules.map { |t| "not #{t.to_s}" }
pieces.concat ed.sort.map { |t| "not on #{t.strftime(TO_S_TIME_FORMAT)}" }
pieces << "until #{end_time.strftime(TIME_FORMAT)}" if end_time
pieces << "until #{end_time.strftime(TO_S_TIME_FORMAT)}" if end_time
pieces.join(' / ')
end

Expand Down
6 changes: 6 additions & 0 deletions spec/examples/to_s_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,10 @@
schedule.to_s.should == 'Weekly 2 times'
end

it 'should work when an end_time is set' do
schedule = IceCube::Schedule.new(Time.local(2012, 8, 31), :end_time => Time.local(2012, 10, 31))
schedule.add_recurrence_rule IceCube::Rule.daily.count(2)
schedule.to_s.should == 'Daily 2 times / until October 31, 2012'
end

end

0 comments on commit c8c542c

Please sign in to comment.