Skip to content

Commit 41dce1f

Browse files
committed
Refactor spec for readability
1 parent 638732e commit 41dce1f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

spec/examples/by_set_pos_spec.rb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@ module IceCube
66
it 'should behave correctly' do
77
schedule = IceCube::Schedule.from_ical "RRULE:FREQ=MONTHLY;COUNT=4;BYDAY=WE;BYSETPOS=4"
88
schedule.start_time = Time.new(2015, 5, 28, 12, 0, 0)
9-
expect(schedule.occurrences_between(Time.new(2015, 01, 01), Time.new(2017, 01, 01))).to eq([
10-
Time.new(2015,6,24,12,0,0),
11-
Time.new(2015,7,22,12,0,0),
12-
Time.new(2015,8,26,12,0,0),
13-
Time.new(2015,9,23,12,0,0)
14-
])
9+
expectations = [
10+
Time.new(2015, 6, 24, 12, 0, 0),
11+
Time.new(2015, 7, 22, 12, 0, 0),
12+
Time.new(2015, 8, 26, 12, 0, 0),
13+
Time.new(2015, 9, 23, 12, 0, 0)
14+
]
15+
expect(schedule.occurrences(Time.new(2017, 01, 01))).to eq(expectations)
1516
end
1617

1718
end
1819

1920
describe YearlyRule, 'BYSETPOS' do
2021
it 'should behave correctly' do
2122
schedule = IceCube::Schedule.from_ical "RRULE:FREQ=YEARLY;BYMONTH=7;BYDAY=SU,MO,TU,WE,TH,FR,SA;BYSETPOS=-1"
22-
schedule.start_time = Time.new(1966,7,5)
23-
expect(schedule.occurrences_between(Time.new(2015, 01, 01), Time.new(2017, 01, 01))).to eq([
24-
Time.new(2015, 7, 31),
25-
Time.new(2016, 7, 31)
26-
])
23+
schedule.start_time = Time.new(1966, 7, 5)
24+
expectations = [
25+
Time.new(2015, 7, 31),
26+
Time.new(2016, 7, 31)
27+
]
28+
expect(schedule.occurrences_between(Time.new(2015, 01, 01), Time.new(2017, 01, 01))).to eq(expectations)
2729
end
2830
end
2931
end

0 commit comments

Comments
 (0)