Sha256: 9c9af68e37919feb8eae8ae828caf31d2f619f268c06d05b6836893e6da3d6d7

Contents?: true

Size: 883 Bytes

Versions: 37

Compression:

Stored size: 883 Bytes

Contents

class CalendarsDataset < Dataset::Base
  uses :calendar_sites if defined? Site
  
  def load
    create_calendar :dummy
    create_calendar :ny
  end
  
  helpers do
    def create_calendar(name, attributes={})
      attributes = calendar_attributes(attributes.update(:name => name))
      calendar = create_model Calendar, name.symbolize, attributes
      calendar.ical = calendar.build_ical(:url => 'stubbed')
      if block_given?
        @calendar = calendar
        yield
      end
    end
    
    def calendar_attributes(attributes={})
      name = attributes[:name] || "Default"
      symbol = name.symbolize
      attributes = {
        :name => name,
        :description => 'A dummy calendar',
        :category => 'test',
        :slug => name.to_s
      }.merge(attributes)
      attributes[:site] = sites(:test) if defined? Site
      attributes
    end
    
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
radiant-event_calendar-extension-1.4.0 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.9 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.8 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.7 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.6 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.5 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.4 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.3 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.2 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.1 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.3.0 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.1.2 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.1.1 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.1.0 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.0.2 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.0.1 spec/datasets/calendars_dataset.rb
radiant-event_calendar-extension-1.0.0 spec/datasets/calendars_dataset.rb