Sha256: bd98e65156874cf279ca51d61ebd6e27a0e932e80206c26aa9671a2779517e37

Contents?: true

Size: 1.41 KB

Versions: 12

Compression:

Stored size: 1.41 KB

Contents

require "spec_helper"
require "lol"

include Lol

describe LolStatusRequest do
  it 'inherits from Request' do
    expect(LolStatusRequest.ancestors[1]).to eq(Request)
  end

  describe '#api_url' do
    it 'returns full url for' do
      expect(subject.api_url('shards')).to eq 'http://status.leagueoflegends.com/shards'
    end

    it 'returns full url with path' do
      expect(subject.api_url('shards', 'something')).to eq 'http://status.leagueoflegends.com/shards/something'
    end
  end

  describe "#shards" do
    let(:response) { subject.shards }

    before(:each) { stub_request(subject, 'lol-status-shards', 'shards') }

    it 'returns an array' do
      expect(response).to be_a(Array)
    end

    it 'returns an array of Shard' do
      expect(response.map(&:class).uniq).to eq([DynamicModel])
    end

    it 'fetches shards from the API' do
      fixture = load_fixture('lol-status-shards', LolStatusRequest.api_version)
      expect(response.size).to eq(fixture.size)
    end
  end

  describe '#current_shard' do
    subject { LolStatusRequest.new 'euw'}
    let(:response) { subject.current_shard }

    before(:each) { stub_request(subject, 'lol-status-shard-by-region', 'shards', 'euw') }

    it 'returns a Shard' do
      expect(response).to be_a(DynamicModel)
    end

    it 'services returns an array of Services' do
      expect(response.services.map(&:class).uniq).to eq([DynamicModel])
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby-lol-0.12.2 spec/lol/lol_status_request_spec.rb
ruby-lol-0.12.1 spec/lol/lol_status_request_spec.rb
ruby-lol-0.12.0 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.6 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.5 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.4 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.3 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.2 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.1 spec/lol/lol_status_request_spec.rb
ruby-lol-0.11.0 spec/lol/lol_status_request_spec.rb
ruby-lol-0.10.0 spec/lol/lol_status_request_spec.rb
ruby-lol-0.9.19.1 spec/lol/lol_status_request_spec.rb