spec/lib/schedule_spec.rb in icalendar-recurrence-1.1.0 vs spec/lib/schedule_spec.rb in icalendar-recurrence-1.1.1
- old
+ new
@@ -24,11 +24,11 @@
expect(example_occurrence).to respond_to :start_time
expect(example_occurrence).to respond_to :end_time
end
end
end
-
+
describe "#all_occurrences" do
let(:example_occurrences) do
weekly_event = example_event :weekly_with_count
schedule = Schedule.new(weekly_event)
schedule.all_occurrences
@@ -41,9 +41,21 @@
expect(example_occurrence).to respond_to :end_time
end
it "returns all occurrences" do
expect(example_occurrences.count).to eq(151)
+ end
+ end
+
+ context "given an event without an end time" do
+ let(:schedule) do
+ weekly_event = example_event :weekly_with_count # has 1 hour duration
+ allow(weekly_event).to receive(:end).and_return(nil)
+ Schedule.new(weekly_event)
+ end
+
+ it "calculates end time based on start_time and duration" do
+ expect(schedule.end_time).to eq(schedule.start_time + 1.hour)
end
end
end