Sha256: 0959cd644a130b6e1eb08dacdbed7affc51ebea3f350cf0330f906e5ae5c3e32

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

require "spec_helper"

describe 'CitiesApi' do
  let(:subject) { AgridClient::CitiesApi.new(api_client) }

  describe "#cities_get" do
    context "without parameters" do
      it "return all cities" do
        response = []
        VCR.use_cassette('cities', record: :new_episodes) do
          response = subject.cities_get
        end
        type_array = response.map(&:class).uniq

        expect(response).to be_an(Array)
        expect(type_array).to eq([AgridClient::CityWithFullState])
      end
    end

    context "with state param" do
      it "return " do
        response = []
        VCR.use_cassette('cities_with_query') do
          response = subject.cities_get(state: 'pr')
        end
        states = response.map { |r| r.state.acronym }.uniq
        expect(states).to eq(['PR'])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
agrid-client-0.0.4 spec/api/cities_api_spec.rb