Sha256: 7be1e43e7f3afac345d1eb5e419e4d3f3c93e0ebc1b389b7525eb80a7852d450

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"
require "lol"

include Lol

describe MatchRequest do
  subject { MatchRequest.new "api_key", "euw" }

  it "inherits from Request" do
    expect(MatchRequest).to be < Request
  end

  describe "#find" do
    it "returns a DynamicModel" do
      stub_request subject, 'match', "matches/1"
      expect(subject.find match_id: 1).to be_a DynamicModel
    end
  end

  describe "#find_timeline" do
    it "returns a DynamicModel" do
      stub_request subject, 'timeline', "timelines/by-match/1"
      expect(subject.find_timeline 1).to be_a DynamicModel
    end
  end

  describe "#ids_by_tournament_code" do
    it "returns a list of ids" do
      stub_request subject, 'ids-by-tc', "matches/by-tournament-code/1/ids"
      result = subject.ids_by_tournament_code '1'
      expect(result).to be_a Array
      expect(result.map(&:class).uniq).to eq [Fixnum]
    end
  end

  describe "#find_by_tournament" do
    it "returns a DynamicModel" do
      stub_request subject, 'match-with-tc', "matches/1/by-tournament-code/2"
      expect(subject.find_by_tournament 1, 2).to be_a DynamicModel
    end
  end

  describe "#all" do
    it "returns a DynamicModel" do
      stub_request subject, 'matches', "matchlists/by-account/1"
      expect(subject.all account_id: 1).to be_a DynamicModel
    end
  end

  describe "#recent" do
    it "returns a DynamicModel" do
      stub_request subject, 'matches-recent', "matchlists/by-account/1/recent"
      expect(subject.recent account_id: 1).to be_a DynamicModel
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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