justinsoong-ri_cal 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +402 -0
- data/Manifest.txt +161 -0
- data/README.txt +410 -0
- data/Rakefile +69 -0
- data/VERSION +1 -0
- data/bin/ri_cal +8 -0
- data/component_attributes/alarm.yml +10 -0
- data/component_attributes/calendar.yml +4 -0
- data/component_attributes/component_property_defs.yml +180 -0
- data/component_attributes/event.yml +45 -0
- data/component_attributes/freebusy.yml +16 -0
- data/component_attributes/journal.yml +35 -0
- data/component_attributes/timezone.yml +3 -0
- data/component_attributes/timezone_period.yml +11 -0
- data/component_attributes/todo.yml +46 -0
- data/copyrights.txt +1 -0
- data/docs/draft-ietf-calsify-2446bis-08.txt +7280 -0
- data/docs/draft-ietf-calsify-rfc2445bis-09.txt +10416 -0
- data/docs/incrementers.txt +7 -0
- data/docs/rfc2445.pdf +0 -0
- data/lib/ri_cal/component/alarm.rb +19 -0
- data/lib/ri_cal/component/calendar.rb +258 -0
- data/lib/ri_cal/component/event.rb +58 -0
- data/lib/ri_cal/component/freebusy.rb +16 -0
- data/lib/ri_cal/component/journal.rb +27 -0
- data/lib/ri_cal/component/non_standard.rb +33 -0
- data/lib/ri_cal/component/t_z_info_timezone.rb +153 -0
- data/lib/ri_cal/component/timezone/daylight_period.rb +25 -0
- data/lib/ri_cal/component/timezone/standard_period.rb +23 -0
- data/lib/ri_cal/component/timezone/timezone_period.rb +76 -0
- data/lib/ri_cal/component/timezone.rb +197 -0
- data/lib/ri_cal/component/todo.rb +42 -0
- data/lib/ri_cal/component.rb +256 -0
- data/lib/ri_cal/core_extensions/array/conversions.rb +15 -0
- data/lib/ri_cal/core_extensions/array.rb +7 -0
- data/lib/ri_cal/core_extensions/date/conversions.rb +56 -0
- data/lib/ri_cal/core_extensions/date.rb +13 -0
- data/lib/ri_cal/core_extensions/date_time/conversions.rb +50 -0
- data/lib/ri_cal/core_extensions/date_time.rb +15 -0
- data/lib/ri_cal/core_extensions/object/conversions.rb +20 -0
- data/lib/ri_cal/core_extensions/object.rb +8 -0
- data/lib/ri_cal/core_extensions/string/conversions.rb +57 -0
- data/lib/ri_cal/core_extensions/string.rb +8 -0
- data/lib/ri_cal/core_extensions/time/calculations.rb +153 -0
- data/lib/ri_cal/core_extensions/time/conversions.rb +42 -0
- data/lib/ri_cal/core_extensions/time/tzid_access.rb +50 -0
- data/lib/ri_cal/core_extensions/time/week_day_predicates.rb +55 -0
- data/lib/ri_cal/core_extensions/time.rb +14 -0
- data/lib/ri_cal/core_extensions.rb +11 -0
- data/lib/ri_cal/fast_date_time.rb +234 -0
- data/lib/ri_cal/floating_timezone.rb +32 -0
- data/lib/ri_cal/invalid_property_value.rb +8 -0
- data/lib/ri_cal/invalid_timezone_identifier.rb +20 -0
- data/lib/ri_cal/occurrence_enumerator.rb +265 -0
- data/lib/ri_cal/occurrence_period.rb +17 -0
- data/lib/ri_cal/parser.rb +145 -0
- data/lib/ri_cal/properties/alarm.rb +390 -0
- data/lib/ri_cal/properties/calendar.rb +164 -0
- data/lib/ri_cal/properties/event.rb +1523 -0
- data/lib/ri_cal/properties/freebusy.rb +593 -0
- data/lib/ri_cal/properties/journal.rb +1237 -0
- data/lib/ri_cal/properties/timezone.rb +150 -0
- data/lib/ri_cal/properties/timezone_period.rb +416 -0
- data/lib/ri_cal/properties/todo.rb +1559 -0
- data/lib/ri_cal/properties.rb +12 -0
- data/lib/ri_cal/property_value/array.rb +27 -0
- data/lib/ri_cal/property_value/cal_address.rb +11 -0
- data/lib/ri_cal/property_value/date.rb +184 -0
- data/lib/ri_cal/property_value/date_time/additive_methods.rb +44 -0
- data/lib/ri_cal/property_value/date_time/time_machine.rb +159 -0
- data/lib/ri_cal/property_value/date_time/timezone_support.rb +100 -0
- data/lib/ri_cal/property_value/date_time.rb +359 -0
- data/lib/ri_cal/property_value/duration.rb +110 -0
- data/lib/ri_cal/property_value/geo.rb +11 -0
- data/lib/ri_cal/property_value/integer.rb +12 -0
- data/lib/ri_cal/property_value/occurrence_list.rb +144 -0
- data/lib/ri_cal/property_value/period.rb +86 -0
- data/lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb +100 -0
- data/lib/ri_cal/property_value/recurrence_rule/enumerator.rb +79 -0
- data/lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb +148 -0
- data/lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb +53 -0
- data/lib/ri_cal/property_value/recurrence_rule/numbered_span.rb +31 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb +86 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb +31 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb +32 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb +52 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb +31 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb +38 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb +32 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb +69 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb +31 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb +28 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb +80 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb +23 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb +106 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb +23 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb +33 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb +43 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb +28 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb +37 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb +57 -0
- data/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb +135 -0
- data/lib/ri_cal/property_value/recurrence_rule/recurring_day.rb +131 -0
- data/lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb +64 -0
- data/lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb +33 -0
- data/lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb +53 -0
- data/lib/ri_cal/property_value/recurrence_rule/time_manipulation.rb +42 -0
- data/lib/ri_cal/property_value/recurrence_rule/validations.rb +125 -0
- data/lib/ri_cal/property_value/recurrence_rule.rb +154 -0
- data/lib/ri_cal/property_value/text.rb +44 -0
- data/lib/ri_cal/property_value/uri.rb +11 -0
- data/lib/ri_cal/property_value/utc_offset.rb +33 -0
- data/lib/ri_cal/property_value/zulu_date_time.rb +34 -0
- data/lib/ri_cal/property_value.rb +159 -0
- data/lib/ri_cal/required_timezones.rb +55 -0
- data/lib/ri_cal.rb +187 -0
- data/parked_specs/ri_cal/claudio_a_bug_spec.rb +100 -0
- data/performance/empty_propval/subject.rb +43 -0
- data/performance/paris_eastern/subject.rb +90 -0
- data/performance/penultimate_weekday/subject.rb +15 -0
- data/performance/psm_big_enum/ical.ics +3171 -0
- data/performance/psm_big_enum/subject.rb +16 -0
- data/performance/utah_cycling/subject.rb +55 -0
- data/ri_cal.gemspec +244 -0
- data/script/benchmark_subject +23 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/profile_subject +29 -0
- data/script/txt2html +71 -0
- data/spec/ri_cal/bugreports_spec.rb +276 -0
- data/spec/ri_cal/component/alarm_spec.rb +12 -0
- data/spec/ri_cal/component/calendar_spec.rb +88 -0
- data/spec/ri_cal/component/event_spec.rb +735 -0
- data/spec/ri_cal/component/freebusy_spec.rb +12 -0
- data/spec/ri_cal/component/journal_spec.rb +37 -0
- data/spec/ri_cal/component/t_z_info_timezone_spec.rb +60 -0
- data/spec/ri_cal/component/timezone_spec.rb +236 -0
- data/spec/ri_cal/component/todo_spec.rb +112 -0
- data/spec/ri_cal/component_spec.rb +224 -0
- data/spec/ri_cal/core_extensions/string/conversions_spec.rb +78 -0
- data/spec/ri_cal/core_extensions/time/calculations_spec.rb +188 -0
- data/spec/ri_cal/core_extensions/time/week_day_predicates_spec.rb +45 -0
- data/spec/ri_cal/fast_date_time_spec.rb +77 -0
- data/spec/ri_cal/inf_loop_spec.rb +78 -0
- data/spec/ri_cal/occurrence_enumerator_spec.rb +611 -0
- data/spec/ri_cal/parser_spec.rb +337 -0
- data/spec/ri_cal/property_value/date_spec.rb +53 -0
- data/spec/ri_cal/property_value/date_time_spec.rb +383 -0
- data/spec/ri_cal/property_value/duration_spec.rb +126 -0
- data/spec/ri_cal/property_value/occurrence_list_spec.rb +72 -0
- data/spec/ri_cal/property_value/period_spec.rb +63 -0
- data/spec/ri_cal/property_value/recurrence_rule/recurring_year_day_spec.rb +21 -0
- data/spec/ri_cal/property_value/recurrence_rule_spec.rb +1814 -0
- data/spec/ri_cal/property_value/text_spec.rb +25 -0
- data/spec/ri_cal/property_value/utc_offset_spec.rb +48 -0
- data/spec/ri_cal/property_value_spec.rb +125 -0
- data/spec/ri_cal/required_timezones_spec.rb +67 -0
- data/spec/ri_cal_spec.rb +53 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +50 -0
- data/tasks/gem_loader/load_active_support.rb +3 -0
- data/tasks/gem_loader/load_tzinfo_gem.rb +2 -0
- data/tasks/ri_cal.rake +412 -0
- data/tasks/spec.rake +102 -0
- metadata +264 -0
@@ -0,0 +1,276 @@
|
|
1
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), %w[.. spec_helper])
|
4
|
+
|
5
|
+
describe "http://rick_denatale.lighthouseapp.com/projects/30941/tickets/17" do
|
6
|
+
it "should parse this" do
|
7
|
+
RiCal.parse_string(<<-ENDCAL)
|
8
|
+
BEGIN:VCALENDAR
|
9
|
+
PRODID:-//Google Inc//Google Calendar 70.9054//EN
|
10
|
+
VERSION:2.0
|
11
|
+
CALSCALE:GREGORIAN
|
12
|
+
METHOD:PUBLISH
|
13
|
+
X-WR-CALNAME:Australian Tech Events
|
14
|
+
X-WR-TIMEZONE:Australia/Sydney
|
15
|
+
X-WR-CALDESC:TO ADD EVENTS INVITE THIS ADDRESS\;\npf44opfb12hherild7h2pl11b
|
16
|
+
4@group.calendar.google.com\n\nThis is a public calendar to know what's com
|
17
|
+
ing up all around the country in the technology industry.\n\nIncludes digit
|
18
|
+
al\, internet\, web\, enterprise\, software\, hardware\, and it's various f
|
19
|
+
lavours. \n\nFeel free to add real events. Keep it real.
|
20
|
+
BEGIN:VTIMEZONE
|
21
|
+
TZID:Australia/Perth
|
22
|
+
X-LIC-LOCATION:Australia/Perth
|
23
|
+
BEGIN:STANDARD
|
24
|
+
TZOFFSETFROM:+0800
|
25
|
+
TZOFFSETTO:+0800
|
26
|
+
TZNAME:WST
|
27
|
+
DTSTART:19700101T000000
|
28
|
+
END:STANDARD
|
29
|
+
END:VTIMEZONE
|
30
|
+
BEGIN:VTIMEZONE
|
31
|
+
TZID:Australia/Sydney
|
32
|
+
X-LIC-LOCATION:Australia/Sydney
|
33
|
+
BEGIN:STANDARD
|
34
|
+
TZOFFSETFROM:+1100
|
35
|
+
TZOFFSETTO:+1000
|
36
|
+
TZNAME:EST
|
37
|
+
DTSTART:19700405T030000
|
38
|
+
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
|
39
|
+
END:STANDARD
|
40
|
+
BEGIN:DAYLIGHT
|
41
|
+
TZOFFSETFROM:+1000
|
42
|
+
TZOFFSETTO:+1100
|
43
|
+
TZNAME:EST
|
44
|
+
DTSTART:19701004T020000
|
45
|
+
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=1SU
|
46
|
+
END:DAYLIGHT
|
47
|
+
END:VTIMEZONE
|
48
|
+
BEGIN:VTIMEZONE
|
49
|
+
TZID:Australia/Brisbane
|
50
|
+
X-LIC-LOCATION:Australia/Brisbane
|
51
|
+
BEGIN:STANDARD
|
52
|
+
TZOFFSETFROM:+1000
|
53
|
+
TZOFFSETTO:+1000
|
54
|
+
TZNAME:EST
|
55
|
+
DTSTART:19700101T000000
|
56
|
+
END:STANDARD
|
57
|
+
END:VTIMEZONE
|
58
|
+
BEGIN:VEVENT
|
59
|
+
DTSTART:20091110T080000Z
|
60
|
+
DTEND:20091110T100000Z
|
61
|
+
DTSTAMP:20090720T133540Z
|
62
|
+
UID:9357CC6B-C4BF-4797-AC5F-83E47C3FDA9E
|
63
|
+
URL:thehive.org.au
|
64
|
+
CLASS:PUBLIC
|
65
|
+
CREATED:20090713T123838Z
|
66
|
+
DESCRIPTION:check the website for details
|
67
|
+
LAST-MODIFIED:20090713T123838Z
|
68
|
+
LOCATION:Melbourne
|
69
|
+
SEQUENCE:1
|
70
|
+
STATUS:CONFIRMED
|
71
|
+
SUMMARY:The Hive MELBOURNE
|
72
|
+
TRANSP:OPAQUE
|
73
|
+
BEGIN:VALARM
|
74
|
+
ACTION:AUDIO
|
75
|
+
TRIGGER:-PT5M
|
76
|
+
X-WR-ALARMUID:F92A055A-2CD9-4FB2-A22A-BD4834ACEE96
|
77
|
+
ATTACH;VALUE=URI:Basso
|
78
|
+
END:VALARM
|
79
|
+
END:VEVENT
|
80
|
+
END:VCALENDAR
|
81
|
+
ENDCAL
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "http://rick_denatale.lighthouseapp.com/projects/30941/tickets/18" do
|
86
|
+
it "should handle a subcomponent" do
|
87
|
+
event = RiCal.Event do |evt|
|
88
|
+
evt.alarm do |alarm|
|
89
|
+
alarm.trigger = "-PT5M"
|
90
|
+
alarm.action = 'AUDIO'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
lambda {event.export}.should_not raise_error
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "http://rick_denatale.lighthouseapp.com/projects/30941/tickets/19" do
|
99
|
+
before(:each) do
|
100
|
+
cals = RiCal.parse_string(<<-ENDCAL)
|
101
|
+
BEGIN:VCALENDAR
|
102
|
+
METHOD:REQUEST
|
103
|
+
PRODID:Microsoft CDO for Microsoft Exchange
|
104
|
+
VERSION:2.0
|
105
|
+
BEGIN:VTIMEZONE
|
106
|
+
TZID:(GMT-05.00) Eastern Time (US & Canada)
|
107
|
+
X-MICROSOFT-CDO-TZID:10
|
108
|
+
BEGIN:STANDARD
|
109
|
+
DTSTART:20010101T020000
|
110
|
+
TZOFFSETFROM:-0400
|
111
|
+
TZOFFSETTO:-0500
|
112
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
|
113
|
+
END:STANDARD
|
114
|
+
BEGIN:DAYLIGHT
|
115
|
+
DTSTART:20010101T020000
|
116
|
+
TZOFFSETFROM:-0500
|
117
|
+
TZOFFSETTO:-0400
|
118
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
|
119
|
+
END:DAYLIGHT
|
120
|
+
END:VTIMEZONE
|
121
|
+
BEGIN:VEVENT
|
122
|
+
DTSTAMP:20090724T143205Z
|
123
|
+
DTSTART;TZID="(GMT-05.00) Eastern Time (US & Canada)":20090804T120000
|
124
|
+
SUMMARY:FW: ALL HANDS MEETING
|
125
|
+
DTEND;TZID="(GMT-05.00) Eastern Time (US & Canada)":20090804T133000
|
126
|
+
DESCRIPTION:Some event
|
127
|
+
END:VEVENT
|
128
|
+
END:VCALENDAR
|
129
|
+
ENDCAL
|
130
|
+
|
131
|
+
@event = cals.first.events.first
|
132
|
+
end
|
133
|
+
|
134
|
+
it "not raise an error accessing DTSTART" do
|
135
|
+
lambda {@event.dtstart}.should_not raise_error
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "freebusy problem" do
|
140
|
+
before(:each) do
|
141
|
+
cal = RiCal.parse_string(<<ENDCAL)
|
142
|
+
BEGIN:VCALENDAR
|
143
|
+
METHOD:PUBLISH
|
144
|
+
VERSION:2.0
|
145
|
+
PRODID:Zimbra-Calendar-Provider
|
146
|
+
BEGIN:VFREEBUSY
|
147
|
+
ORGANIZER:mailto:bj-wagoner@wiu.edu
|
148
|
+
DTSTAMP:20090805T200417Z
|
149
|
+
DTSTART:20090705T200417Z
|
150
|
+
DTEND:20091006T200417Z
|
151
|
+
URL:https://zimbra9.wiu.edu/service/home/bjw101/calendar.ifb?null
|
152
|
+
FREEBUSY;FBTYPE=BUSY:20090705T200417Z/20090707T050000Z
|
153
|
+
FREEBUSY;FBTYPE=BUSY-TENTATIVE:20090711T050000Z/20090712T050000Z
|
154
|
+
END:VFREEBUSY
|
155
|
+
END:VCALENDAR
|
156
|
+
ENDCAL
|
157
|
+
@free_busy = cal.first.freebusys.first
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should have two periods" do
|
161
|
+
@free_busy.freebusy.map {|fb| fb.to_s}.should == [
|
162
|
+
";FBTYPE=BUSY:20090705T200417Z/20090707T050000Z",
|
163
|
+
";FBTYPE=BUSY-TENTATIVE:20090711T050000Z/20090712T050000Z"
|
164
|
+
]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "a calendar including vvenue" do
|
169
|
+
before(:each) do
|
170
|
+
@cal_string = <<ENDCAL
|
171
|
+
BEGIN:VCALENDAR
|
172
|
+
VERSION:2.0
|
173
|
+
X-WR-CALNAME:Upcoming Event: Film in the Park
|
174
|
+
PRODID:-//Upcoming.org/Upcoming ICS//EN
|
175
|
+
CALSCALE:GREGORIAN
|
176
|
+
METHOD:PUBLISH
|
177
|
+
BEGIN:VEVENT
|
178
|
+
DTSTART:20090807T201500
|
179
|
+
DTEND:20090807T220000
|
180
|
+
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20090822T000000
|
181
|
+
GEO:-104.997;39.546
|
182
|
+
TRANSP:TRANSPARENT
|
183
|
+
SUMMARY:Film in the Park
|
184
|
+
DESCRIPTION: [Full details at http://upcoming.yahoo.com/event/3082410/ ] Plan to join the HRCA family summer tradition! Bring a blanket and enjoy great FREE family movies! Mark the dates now!
|
185
|
+
URL;VALUE=URI:http://upcoming.yahoo.com/event/3082410/
|
186
|
+
UID:http://upcoming.yahoo.com/event/3082410/
|
187
|
+
DTSTAMP:20090716T103006
|
188
|
+
LAST-UPDATED:20090716T103006
|
189
|
+
CATEGORIES:Family
|
190
|
+
ORGANIZER;CN=mepling95:X-ADDR:http://upcoming.yahoo.com/user/637615/
|
191
|
+
LOCATION;VENUE-UID="http://upcoming.yahoo.com/venue/130821/":Civic Green Park @ 9370 Ridgeline Boulevard\, Highlands Ranch\, Colorado 80126 US
|
192
|
+
END:VEVENT
|
193
|
+
BEGIN:VVENUE
|
194
|
+
X-VVENUE-INFO:http://evdb.com/docs/ical-venue/drft-norris-ical-venue.html
|
195
|
+
NAME:Civic Green Park
|
196
|
+
ADDRESS:9370 Ridgeline Boulevard
|
197
|
+
CITY:Highlands Ranch
|
198
|
+
REGION;X-ABBREV=co:Colorado
|
199
|
+
COUNTRY;X-ABBREV=us:United States
|
200
|
+
POSTALCODE:80126
|
201
|
+
GEO:39.546;-104.997
|
202
|
+
URL;X-LABEL=Venue Info:http://www.hrmafestival.org
|
203
|
+
END:VVENUE
|
204
|
+
END:VCALENDAR
|
205
|
+
ENDCAL
|
206
|
+
|
207
|
+
@venue_str = <<ENDVENUE
|
208
|
+
BEGIN:VVENUE
|
209
|
+
X-VVENUE-INFO:http://evdb.com/docs/ical-venue/drft-norris-ical-venue.html
|
210
|
+
NAME:Civic Green Park
|
211
|
+
ADDRESS:9370 Ridgeline Boulevard
|
212
|
+
CITY:Highlands Ranch
|
213
|
+
REGION;X-ABBREV=co:Colorado
|
214
|
+
COUNTRY;X-ABBREV=us:United States
|
215
|
+
POSTALCODE:80126
|
216
|
+
GEO:39.546;-104.997
|
217
|
+
URL;X-LABEL=Venue Info:http://www.hrmafestival.org
|
218
|
+
END:VVENUE
|
219
|
+
ENDVENUE
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should parse without error" do
|
223
|
+
lambda {RiCal.parse_string(@cal_string)}.should_not raise_error
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should export correctly" do
|
227
|
+
export = RiCal.parse_string(@cal_string).first.export
|
228
|
+
export.should include(@venue_str)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
context "ticket #23" do
|
233
|
+
describe "RecurrenceRule" do
|
234
|
+
it "should convert the rrule string to a hash" do
|
235
|
+
rrule = RiCal::PropertyValue::RecurrenceRule.convert(nil, 'INTERVAL=2;FREQ=WEEKLY;BYDAY=TH,TU')
|
236
|
+
rrule.to_options_hash.should == {:freq => 'WEEKLY', :byday => %w{TH TU}, :interval => 2}
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
context "ticket #26" do
|
242
|
+
context "Date property" do
|
243
|
+
it "should handle for_parent" do
|
244
|
+
lambda {
|
245
|
+
RiCal::PropertyValue::Date.convert(:foo, Date.parse("20090927")).for_parent(:bar)}.should_not raise_error
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
context "ticket 29:supress-x-rical-tzsource-when-not-relevant" do
|
251
|
+
it "should parse its own output" do
|
252
|
+
cal_string = %Q(BEGIN:VCALENDAR
|
253
|
+
PRODID:-//Google Inc//Google Calendar 70.9054//EN
|
254
|
+
BEGIN:VEVENT
|
255
|
+
DTSTART:20100610T100000
|
256
|
+
DTEND:20100610T110000
|
257
|
+
END:VEVENT
|
258
|
+
END:VCALENDAR)
|
259
|
+
lambda {RiCal.parse_string(RiCal.parse_string(cal_string).first.to_s)}.should_not raise_error
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
context "X-properties" do
|
264
|
+
it "should round-trip the X-WR-CALNAME property" do
|
265
|
+
cal_string = %Q(BEGIN:VCALENDAR
|
266
|
+
PRODID:-//Markthisdate.com\,0.7
|
267
|
+
VERSION:2.0
|
268
|
+
CALSCALE:GREGORIAN
|
269
|
+
METHOD:PUBLISH
|
270
|
+
X-WR-CALNAME: AFC Ajax Eredivisie wedstrijden 2010 - 2011
|
271
|
+
END:VCALENDAR)
|
272
|
+
cal = RiCal.parse_string(cal_string).first
|
273
|
+
cal.x_wr_calname.first.should == " AFC Ajax Eredivisie wedstrijden 2010 - 2011"
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
4
|
+
|
5
|
+
describe RiCal::Component::Alarm do
|
6
|
+
|
7
|
+
describe ".entity_name" do
|
8
|
+
it "should be VALARM" do
|
9
|
+
RiCal::Component::Alarm.entity_name.should == "VALARM"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
|
5
|
+
|
6
|
+
describe RiCal::Component::Calendar do
|
7
|
+
|
8
|
+
context ".entity_name" do
|
9
|
+
it "should be VCALENDAR" do
|
10
|
+
RiCal::Component::Calendar.entity_name.should == "VCALENDAR"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "a new instance" do
|
15
|
+
before(:each) do
|
16
|
+
@it = RiCal.Calendar
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a tz_source of 'TZ_INFO" do
|
20
|
+
@it.tz_source.should == "TZINFO"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should export a product id with an X-RICAL-TZSOURCE parameter of TZINFO" do
|
24
|
+
@it.export.should match(%r{\nPRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN\n})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "an imported instance with a tzinfo source" do
|
29
|
+
before(:each) do
|
30
|
+
@it = RiCal.parse_string("BEGIN:VCALENDAR\nPRODID;X-RICAL-TZSOURCE=TZINFO:-\/\/com.denhaven2\/NONSGML ri_cal gem\/\/EN\nCALSCALE:GREGORIAN\nVERSION:2.0\nEND:VCALENDAR\n").first
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have a tz_source of 'TZ_INFO" do
|
34
|
+
@it.tz_source.should == "TZINFO"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should export a product id with an X-RICAL-TZSOURCE parameter of TZINFO" do
|
38
|
+
@it.export.should match(%r{\nPRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN\n})
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "an imported instance without a tzinfo source" do
|
43
|
+
before(:each) do
|
44
|
+
@it = RiCal.parse_string("BEGIN:VCALENDAR\nPRODID:-//Apple Inc.//iCal 3.0//EN\nEND:VCALENDAR\n").first
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have a tz_source of nil" do
|
48
|
+
@it.tz_source.should be_nil
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should export not export a product id with an X-RICAL-TZSOURCE parameter of TZINFO" do
|
52
|
+
@it.export.should_not match(%r{X-RICAL-TZSOURCE=TZINFO:})
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe RiCal::Component::Calendar::FoldingStream do
|
57
|
+
before(:each) do
|
58
|
+
@it = RiCal::Component::Calendar::FoldingStream.new(nil)
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#utf_safe_split" do
|
62
|
+
it "should properly split an ascii string" do
|
63
|
+
@it.utf8_safe_split("abcdef", 3).should == ["abc", "def"]
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should return a nil remainder if the string has less than n characters" do
|
67
|
+
@it.utf8_safe_split("a",2).should == ["a", nil]
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return a nil remainder if the string has exactly n characters" do
|
71
|
+
@it.utf8_safe_split("ab",2).should == ["ab", nil]
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should not split a 2-byte utf character" do
|
75
|
+
@it.utf8_safe_split("Café", 3).should == ["Caf", "é"]
|
76
|
+
@it.utf8_safe_split("Café", 4).should == ["Caf", "é"]
|
77
|
+
@it.utf8_safe_split("Café", 5).should == ["Café", nil]
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should not split a 3-byte utf character" do
|
81
|
+
@it.utf8_safe_split("Prix €200", 5).should == ["Prix ", "€200"]
|
82
|
+
@it.utf8_safe_split("Prix €200", 6).should == ["Prix ", "€200"]
|
83
|
+
@it.utf8_safe_split("Prix €200", 7).should == ["Prix ", "€200"]
|
84
|
+
@it.utf8_safe_split("Prix €200", 8).should == ["Prix €", "200"]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|