Sha256: f7a77256b1dc5f6084c400cc1f66e8acd54405ae40e2ba10b07c7e63038346a4
Contents?: true
Size: 1.54 KB
Versions: 10
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' require 'lol' describe Lol::CurrentGameRequest do subject { Lol::CurrentGameRequest.new 'api_key', 'euw' } it 'inherits from Lol::Request' do expect(subject.class.ancestors[1]).to eq Lol::Request end describe '#api_url' do it 'returns base_url joined with the given path and the api query string' do expect(subject.api_url 'foo').to eq "https://euw.api.pvp.net/observer-mode/rest/consumer/foo?api_key=api_key" end it 'delegates to api_base_url' do allow(subject).to receive(:api_base_url).and_return 'bar' expect(subject.api_url 'foo').to match /^bar\/observer-mode\/rest\/consumer\/foo/ end it 'delegates to api_query_string' do allow(subject).to receive(:api_query_string).with(a: 'a').and_return 'baz' expect(subject.api_url 'foo', a: 'a').to match /foo\?baz$/ end end describe '#spectator_game_info' do let(:expected_url) { 'getSpectatorGameInfo/EUW1/1' } it 'requires platform and summoner id' do expect { subject.spectator_game_info }.to raise_error ArgumentError, /\(0 for 2\)/ end it 'returns a DynamicModel' do stub_request subject, 'current-game', expected_url expect(subject.spectator_game_info 'EUW1', '1').to be_a DynamicModel end it 'gives the response to DynamicModel' do allow(subject).to receive(:perform_request).with(instance_of(String)).and_return 'a' expect(Lol::DynamicModel).to receive(:new).with('a').and_return 'foo' subject.spectator_game_info 'EUW1', '1' end end end
Version data entries
10 entries across 10 versions & 1 rubygems