Skip to content

Commit

Permalink
Escape location string. [#65]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Dec 27, 2011
1 parent f0845b4 commit 3e36310
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/events/ical.ics.erb
Expand Up @@ -4,7 +4,7 @@ VERSION:2.0
BEGIN:VEVENT
UID:<%= ical_uid @event %>
SUMMARY:<%= ical_escape @event.name %>
LOCATION:<%= [@event.street, @event.street2, @event.city, @event.state.code, @event.country.code].compact.join(', ') %>
LOCATION:<%= ical_escape [@event.street, @event.street2, @event.city, @event.state.code, @event.country.code].compact.join(', ') %>
DESCRIPTION:<%= ical_escape @event.description %>
DTSTART;VALUE=DATE:<%= @event.date.to_s :ical %>
END:VEVENT
Expand Down
3 changes: 2 additions & 1 deletion spec/views/events/ical.ics.erb_spec.rb
Expand Up @@ -23,7 +23,8 @@
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(', ')}")
escaped_location = ical_escape [@event.street, @event.street2, @event.city, @event.state.code, @event.country.code].compact.join(', ')
rendered.should have_content("LOCATION:#{escaped_location}")
end

it "should contain the event description as description" do
Expand Down

0 comments on commit 3e36310

Please sign in to comment.