spec/lib/schedule_spec.rb in icalendar-recurrence-1.0.1 vs spec/lib/schedule_spec.rb in icalendar-recurrence-1.1.0
- old
+ new
@@ -1,22 +1,8 @@
require 'spec_helper'
describe Icalendar::Recurrence::Schedule do
- describe "#transform_byday_to_hash" do
- it "returns an array of days when no monthly interval is set" do
- byday = ["MO", "WE", "FR"]
- schedule = Schedule.new(nil)
- expect(schedule.transform_byday_to_hash(byday)).to eq([:monday, :wednesday, :friday])
- end
-
- it "returns hash with day of week and interval" do
- byday = ["1SA"]
- schedule = Schedule.new(nil);
- expect(schedule.transform_byday_to_hash(byday)).to eq({saturday: [1]})
- end
- end
-
describe "#occurrences_between" do
let(:example_occurrence) do
daily_event = example_event :daily
schedule = Schedule.new(daily_event)
schedule.occurrences_between(Date.parse("2014-02-01"), Date.parse("2014-03-01")).first
@@ -38,15 +24,26 @@
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
+ end
- describe "#parse_ical_byday" do
- let(:schedule) { Schedule.new(nil) }
+ let(:example_occurrence) { example_occurrences.first }
- it "returns a hash of data" do
- expect(schedule.parse_ical_byday("1SA")).to eq({day_code: "SA", position: 1})
- expect(schedule.parse_ical_byday("MO")).to eq({day_code: "MO", position: 0})
+ it "returns object that responds to start_time and end_time" do
+ expect(example_occurrence).to respond_to :start_time
+ expect(example_occurrence).to respond_to :end_time
end
+
+ it "returns all occurrences" do
+ expect(example_occurrences.count).to eq(151)
+ end
end
-end
\ No newline at end of file
+
+end