Skip to content

Subsequent monthly bug fix #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def advance_what

def step(date_time)
if contains_daily_incrementer?
result = super(date_time).change(:day => 1)
result = super(date_time).change(:day => date_time.day)
result
else
super(date_time)
Expand Down
45 changes: 45 additions & 0 deletions spec/ri_cal/occurrence_enumerator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,51 @@ def mock_enumerator(name, next_occurrence)
@occurrences.all? {|o| o.dtend.class == ::Date}.should be_true
end
end

context "Subsequent Monthy Occurence Bug" do
before(:each) do
cal = RiCal.parse_string rectify_ical(<<-ENDCAL)
BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20090520T092032Z
LAST-MODIFIED:20090520T092052Z
DTSTAMP:20090520T092032Z
UID:d41c124a-65c3-400e-bd04-1d2ee7b98352
SUMMARY:event2
RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=4;BYMONTHDAY=24;
DTSTART;VALUE=DATE:20090624
DTEND;VALUE=DATE:20091024
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
ENDCAL
@occurrences = cal.first.events.first.occurrences(
:after => Date.parse('01/11/2009'),
:before => Date.parse("01/11/2009")
)
end

it "should produce the right dtstart values" do
@occurrences.map {|o| o.dtstart}.should == [
Date.parse("2009-06-24"),
Date.parse("2009-07-24"),
Date.parse("2009-08-24"),
Date.parse("2009-09-24"),
]
end

it "should produce events whose dtstarts are all dates" do
@occurrences.all? {|o| o.dtstart.class == ::Date}.should be
end

it "should produce events whose dtstends are all dates" do
@occurrences.all? {|o| o.dtend.class == ::Date}.should be
end
end


context "bounded? bug" do
before(:each) do
events = RiCal.parse_string rectify_ical(<<-ENDCAL)
Expand Down