Sha256: 1f4221ea6b61fe01765463b88940d546ef960761d19315b57357ce396bd46686

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

module Almanack::EventSource
  describe MeetupGroup do
    describe "#events_between" do
      it "returns a list of events" do
        feed = MeetupGroup.new(group_urlname: 'The-Foundation-Christchurch',
                               key: 'secrettoken',
                               connection: Faraday.new)
        events = nil

        Timecop.freeze(2014, 5, 24) do
          VCR.use_cassette('meetup') do
            from = Time.now
            to = from + 30 * 24 * 60 * 60
            events = feed.events_between(from..to)
          end
        end

        start_dates = events.map(&:start_date)

        expect(events.length).to eq(5)
        expect(events).to all_have_properties(:title, :start_date, :end_date, :description, :location)
      end

      it "handles a missing location" do
        feed = MeetupGroup.new(group_urlname: 'adventurewellington',
                               key: 'secrettoken',
                               connection: Faraday.new)

        Timecop.freeze(2014, 7, 23) do
          VCR.use_cassette('meetup-without-location') do
            from = Time.now
            to = from + 30 * 24 * 60 * 60
            expect { feed.events_between(from..to) }.not_to raise_error
          end
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
almanack-1.0.5 spec/event_source/meetup_group_spec.rb
almanack-1.0.4 spec/event_source/meetup_group_spec.rb