Sha256: 3f619d4f044e316a31caf1fd9c37689b45e8ba3eedcd2b87f1d93bebd260f455

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

RSpec.describe ChgkRating::Collections::Teams do
  subject do
    VCR.use_cassette 'teams' do
      described_class.new
    end
  end
  let(:team) { subject[1] }

  it_behaves_like 'not a hash'
  it_behaves_like 'an array'

  specify('#id') { expect(team.id).to eq '2' }
  specify('#town') { expect(team.town).to eq 'Москва' }
  specify('#name') { expect(team.name).to eq 'Афина' }
  specify '#to_a' do
    teams_arr = subject.to_a
    expect(teams_arr.count).to eq 1000
    expect(teams_arr[3]['idteam']).to eq '5'
  end

  context 'pagination' do
    subject do
      VCR.use_cassette 'teams_page3' do
        described_class.new(page: 3)[1]
      end
    end

    specify('#id') { expect(subject.id).to eq '2285' }
    specify('#name') { expect(subject.name).to eq 'Эффект внезапности' }
  end

  context 'searching' do
    subject do
      VCR.use_cassette 'teams_searching' do
        described_class.search(request: {name: 'э', town: 'мин'})[0]
      end
    end

    specify('#id') { expect(subject.id).to eq '5444' }
    specify('#name') { expect(subject.name).to eq 'Эйфью' }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chgk_rating-1.0.0.rc1 spec/lib/chgk_rating/collections/teams_spec.rb