Skip to content

Commit

Permalink
Add PRODID field to iCal export. [#65]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Dec 27, 2011
1 parent 52e9bb4 commit f0845b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/views/events/ical.ics.erb
@@ -1,4 +1,5 @@
BEGIN:VCALENDAR
PRODID:-//quorum2.sf.net//<%= SITE_TITLE %> <%= APP_VERSION %>//EN
VERSION:2.0
BEGIN:VEVENT
UID:<%= ical_uid @event %>
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/app_globals.rb
Expand Up @@ -5,6 +5,8 @@
require 'yaml'
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]

APP_VERSION = '0.3.9'

SITE_TITLE = "Quorum" # Name of site as it appears in <title> element

DOMAIN = APP_CONFIG['domain'] # Domain on which the site is hosted
Expand Down
14 changes: 9 additions & 5 deletions spec/views/events/ical.ics.erb_spec.rb
Expand Up @@ -9,23 +9,27 @@
assign :event, @event
render :file => 'events/ical.ics.erb'
end


it "should countain a product identifier" do
rendered.should have_content("PRODID:-//quorum2.sf.net//#{SITE_TITLE} #{APP_VERSION}//EN")
end

it "should contain the iCal UID" do
rendered.should have_content("UID:#{ical_uid @event}")
end

it "should contain the event name as a summary" do
rendered.should have_content("SUMMARY:#{ical_escape @event.name}")
end

it "should contain the event address as location" do
rendered.should have_content("LOCATION:#{[@event.street, @event.street2, @event.city, @event.state.code, @event.country.code].compact.join(', ')}")
end

it "should contain the event description as description" do
rendered.should have_content("DESCRIPTION:#{ical_escape @event.description}")
end

it "should contain the date in iCal format" do
rendered.should have_content("DTSTART;VALUE=DATE:#{@event.date.to_s :ical}")
end
Expand Down

0 comments on commit f0845b4

Please sign in to comment.