Sha256: 20c8185573ce92c6b6de575f1d6f9205832588b5989c0c0c329d7b3990c341a7

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"
require "lol"

include Lol

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

  let(:request) { ChampionRequest.new("api_key", "euw") }

  describe "#get" do

    context "specifying an id" do
      subject { request.get(:id => 266) }

      before(:each) { stub_request(request, 'champion-266', 'champion/266', 'freeToPlay' => false) }

      it "returns a champion" do
        expect(subject).to be_a(Champion)
      end
    end

    context "getting all" do
      subject { request.get }

      before(:each) { stub_request(request, 'champion', 'champion', 'freeToPlay' => false) }

      it "returns an array" do
        expect(subject).to be_a(Array)
      end

      it "returns an array of champions" do
        expect(subject.map {|e| e.class}.uniq).to eq([Champion])
      end

      it "fetches champions from the API" do
        expect(subject.size).to eq(load_fixture("champion", ChampionRequest.api_version)["champions"].size)
      end

    end


  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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