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