Sha256: 566e7658bce3f5bd7413a086bd32e1e25868f0f13327ee2f3815daa7a7872806

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

Contents

describe "Event" do
  let :connection do
    double(:connection, get: nil)
  end

  let :event_search_response do
    File.read(File.expand_path("spec/responses/venue_search_response.json"))
  end

  let :invalid_search_response do
    File.read(File.expand_path("spec/responses/invalid_key_response.json"))
  end

  describe "search" do
    it "should return an Array of Parkwhiz::Events" do
      Parkwhiz.connection = connection
      expect(connection).to receive(:get) { double( body: JSON.parse(event_search_response) ) }
      events = Parkwhiz::Event.search({})
      expect(events).to be_kind_of(Array)
      expect(events.first).to be_kind_of(Parkwhiz::Event)
    end

    it "should raise a search error if bad search response" do
      expect(connection).to receive(:get) { double( body: JSON.parse(invalid_search_response) ) }
      Parkwhiz.connection = connection
      expect do
        Parkwhiz.search({})
      end.to raise_error(Parkwhiz::SearchError)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parkwhiz-0.4.0 spec/event_spec.rb
parkwhiz-0.3.0 spec/event_spec.rb