Sha256: 58ef7e70e7ee904b7d2dd6bdbe3cbb20a0c1ba342a780a85323fb8e5d97babe4
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true RSpec.describe RatingChgkV2::Collections::BaseCollection do let(:players) do described_class.new [{ id: 1, name: 'Ivan', surname: 'Petrov' }, { id: 2, name: 'Petr', surname: 'Ivanov' }] end specify '#first' do stub_const "#{described_class}::MODEL", 'Player' player = players.first expect(player).to be_an_instance_of(RatingChgkV2::Models::PlayerModel) expect(player.id).to eq(1) end specify '#last' do stub_const "#{described_class}::MODEL", 'Player' player = players.last expect(player).to be_an_instance_of(RatingChgkV2::Models::PlayerModel) expect(player.id).to eq(2) end specify '#[]' do stub_const "#{described_class}::MODEL", 'Player' player = players[1] expect(player.id).to eq(2) end specify '#each' do stub_const "#{described_class}::MODEL", 'Player' klass = RatingChgkV2::Models::PlayerModel expect { |b| players.each(&b) }.to yield_successive_args(klass, klass) end specify '#map' do stub_const "#{described_class}::MODEL", 'Player' mapped = players.map(&:id) expect(mapped).to include(1, 2) 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/collections/base_collection_spec.rb |
rating-chgk-v2-1.0.0.rc1 | spec/lib/rating_chgk_v2/collections/base_collection_spec.rb |