Skip to content
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pkg/
profiles/
doc/
\.DS_Store
.ackrc
.ackrc
.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def initialize(rrule, list, by_monthday_list, by_yearday_list, parent)
@cycle_advance_proc = lambda {|date_time| first_day_of_month(advance_month(date_time))}
@current_proc = lambda {|date_time| same_month?(current, date_time)}
@first_day_proc = lambda {|date_time| first_day_of_month(date_time)}
when :weekly
when :weekly, :daily
@cycle_advance_proc = lambda {|date_time| first_day_of_week(rrule.wkst_day, advance_week(date_time))}
@current_proc = lambda {|date_time| same_week?(rrule.wkst_day, current, date_time)}
@first_day_proc = lambda {|date_time| first_day_of_week(rrule.wkst_day, date_time)}
else
raise "Invalid recurrence rule, byday needs to be scoped by month, week or year"
raise "Invalid recurrence rule, byday needs to be scoped by month, week, day or year"
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/ri_cal/property_value/recurrence_rule/recurring_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def list_id(time)
time.year
when :monthly
(time.year * 100) + time.month
when :weekly
when :weekly, :daily
time.at_start_of_week_with_wkst(rrule.wkst_day).jd
end
end
Expand All @@ -60,7 +60,7 @@ def matches_for(time)
yearly_matches_for(time)
when :monthly
monthly_matches_for(time)
when :weekly
when :weekly, :daily
weekly_matches_for(time)
else
walkback = caller.grep(/recurrence/i)
Expand Down
45 changes: 37 additions & 8 deletions spec/ri_cal/bugreports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
end
end

context "ticket #23" do
describe "ticket #23" do
describe "RecurrenceRule" do
it "should convert the rrule string to a hash" do
rrule = RiCal::PropertyValue::RecurrenceRule.convert(nil, 'INTERVAL=2;FREQ=WEEKLY;BYDAY=TH,TU')
Expand All @@ -238,16 +238,16 @@
end
end

context "ticket #26" do
context "Date property" do
describe "ticket #26" do
describe "Date property" do
it "should handle for_parent" do
lambda {
RiCal::PropertyValue::Date.convert(:foo, Date.parse("20090927")).for_parent(:bar)}.should_not raise_error
end
end
end

context "ticket 29:supress-x-rical-tzsource-when-not-relevant" do
describe "ticket 29:supress-x-rical-tzsource-when-not-relevant" do
it "should parse its own output" do
cal_string = %Q(BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
Expand All @@ -260,7 +260,7 @@
end
end

context "X-properties" do
describe "X-properties" do
it "should round-trip the X-WR-CALNAME property" do
cal_string = %Q(BEGIN:VCALENDAR
PRODID:-//Markthisdate.com\,0.7
Expand All @@ -269,8 +269,37 @@
METHOD:PUBLISH
X-WR-CALNAME: AFC Ajax Eredivisie wedstrijden 2010 - 2011
END:VCALENDAR)
cal = RiCal.parse_string(cal_string).first
cal.x_wr_calname.first.should == " AFC Ajax Eredivisie wedstrijden 2010 - 2011"
end
cal = RiCal.parse_string(cal_string).first
cal.x_wr_calname.first.should == " AFC Ajax Eredivisie wedstrijden 2010 - 2011"
end
end

describe "RRULE_DAILY_BYDAY" do
it "should parse and generate" do
cal_string = %Q(BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
CREATED;VALUE=DATE-TIME:20110320T181053Z
DTEND;VALUE=DATE:20110412
STATUS:CONFIRMED
DTSTART;VALUE=DATE:20110411
TRANSP:TRANSPARENT
DTSTAMP;VALUE=DATE-TIME:20120810T174438Z
SUMMARY:Pragmatic Marketing
RRULE:FREQ=DAILY;UNTIL=20110413;BYDAY=MO,TU,WE,TH,FR
LOCATION:
SEQUENCE:0
END:VEVENT
END:VCALENDAR)
cal = RiCal.parse_string(cal_string).first
e = cal.events.first
e.recurs?.should be_true
e.bounded?.should be_true
twelfth = Date.parse('2011-04-12')
e.occurrences(:overlapping => [twelfth, twelfth]).size.should eql 2
end
end