Sha256: a15278a41f78966e8eef0520d647bb8e88141582ca2a1024c0dbfaefb2d6ae8c

Contents?: true

Size: 1.71 KB

Versions: 4

Compression:

Stored size: 1.71 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe EventCalendarTags do
  dataset :calendar_pages, :calendar_events
  let(:page) { pages(:calendar) }
  let(:event) { events(:simple) }
  let(:fbe) { events(:facebooked) }
    
  context "rendering event: tags" do
    before do
      Radiant.config['site.host'] = "test.host"
    end
    
    [:id, :title, :description, :short_description, :location, :url, :facebook_id, :facebook_url].each do |tag|
      it "event:#{tag}" do
        page.should render(%{<r:event id="#{event.id}"><r:event:#{tag} /></r:event>}).as( event.send(tag.to_sym).to_s )
      end
    end
    
    it "event:ical_link" do
      page.should render(%{<r:event id="#{event.id}"><r:event:ical_link class="ical">I</r:event:ical_link></r:event>}).as( 
        %{<a href="/cal/events/#{event.id}.ics" title="Download event" class="ical">I</a>} 
      )
    end

    it "event:facebook_link" do
      page.should render(%{<r:event id="#{fbe.id}"><r:event:facebook_link class="fb">F</r:event:facebook_link></r:event>}).as( 
        %{<a href="http://www.facebook.com/event.php?eid=#{fbe.facebook_id}" title="view on facebook" class="fb">F</a>} 
      )
      page.should render(%{<r:event id="#{event.id}"><r:event:facebook_link class="fb">F</r:event:facebook_link></r:event>}).as( "" )
    end
    
    it "event:tweet_link" do
      page.should render(%{<r:event id="#{event.id}"><r:event:tweet_link class="twit" text="foo: & bar" via="me" related="they">T</r:event:tweet_link></r:event>}).as( 
        %{<a href="https://twitter.com/intent/tweet?url=http://test.host/calendar/%23event_#{event.id}&amp;text=foo:%20&%20bar&amp;via=me&amp;related=they" title="Tweet this" class="twit">T</a>} 
      )
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-event_calendar-extension-1.5.6 spec/lib/event_calendar_tags_spec.rb
radiant-event_calendar-extension-1.5.5 spec/lib/event_calendar_tags_spec.rb
radiant-event_calendar-extension-1.5.4 spec/lib/event_calendar_tags_spec.rb
radiant-event_calendar-extension-1.5.3 spec/lib/event_calendar_tags_spec.rb