Sha256: 7fa57b2dc1df1f1e26e5bb6fddcf6d467a276ef0c6d848feb07673d37cc9689c

Contents?: true

Size: 928 Bytes

Versions: 2

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true

RSpec.describe RatingChgkV2::Rest::Towns do
  let(:town_id) { 1 }

  specify '#town' do
    town = VCR.use_cassette('towns/town') do
      test_client.town(town_id)
    end

    expect(town.id).to eq(town_id)
    expect(town.name).to eq('Абакан')
    expect(town.region['name']).to eq('Хакасия')
    expect(town.country['name']).to eq('Россия')
  end

  describe '#towns' do
    it 'returns a collection of towns' do
      towns = VCR.use_cassette('towns/all_towns') do
        test_client.towns
      end

      expect(towns[0].name).to eq('Абакан')
    end

    it 'returns a collection of towns with params' do
      towns = VCR.use_cassette('towns/all_towns_params') do
        test_client.towns itemsPerPage: 2, page: 3
      end

      expect(towns.count).to eq(2)
      expect(towns[0].name).to eq('Анапа')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rating-chgk-v2-1.0.0 spec/lib/rating_chgk_v2/rest/towns_spec.rb
rating-chgk-v2-1.0.0.rc1 spec/lib/rating_chgk_v2/rest/towns_spec.rb