Sha256: 41662100982f9afb22d476a6153c85374c218b8b7334476191e92dea9b6002b6

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

require "spec_helper"
require "lol"

include Lol

describe ChampionRequest do
  subject { described_class.new("api_key", "euw") }

  it "inherits from Request" do
    expect(described_class.ancestors[1]).to eq(Request)
  end

  describe "#find" do
    it "returns a champion" do
      stub_request subject, 'champion-266', 'champions/266'
      expect(subject.find 266).to be_a DynamicModel
    end
  end

  describe "#all" do
    before { stub_request subject, 'champion-all', 'champions', 'freeToPlay' => false }
    let(:result) { subject.all }

    it "returns an array of champions" do
      expect(result).to be_a Array
      expect(result.map(&:class).uniq).to eq [DynamicModel]
    end

    it "fetches champions from the API" do
      expect(result.size).to eq load_fixture('champion-all', described_class.api_version)['champions'].size
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-lol-1.2.0 spec/lol/champion_request_spec.rb
ruby-lol-1.1.2 spec/lol/champion_request_spec.rb
ruby-lol-1.1.1 spec/lol/champion_request_spec.rb
ruby-lol-1.0.0 spec/lol/champion_request_spec.rb