Sha256: 57beb7ada67b946b1abe2dd4d70308b9f8ba64506c29795fc3139ed1ce3806a0

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

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

  let :venue_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::Venues" do
      Parkwhiz.connection = connection
      expect(connection).to receive(:get) { double( body: JSON.parse(venue_search_response) ) }
      venues = Parkwhiz::Venue.search({})
      expect(venues).to be_kind_of(Array)
      expect(venues.first).to be_kind_of(Parkwhiz::Venue)
    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

3 entries across 3 versions & 1 rubygems

Version Path
parkwhiz-0.4.0 spec/venue_spec.rb
parkwhiz-0.3.0 spec/venue_spec.rb
parkwhiz-0.2.0 spec/venue_spec.rb