ruby-lol 0.9.18 → 0.9.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -0
  3. data/lib/lol/league.rb +2 -3
  4. data/lib/lol/league_entry.rb +1 -5
  5. data/lib/lol/league_request.rb +30 -23
  6. data/lib/lol/match_history_request.rb +10 -0
  7. data/lib/lol/match_request.rb +10 -0
  8. data/lib/lol/request.rb +4 -1
  9. data/lib/lol/team_request.rb +9 -6
  10. data/lib/lol/version.rb +1 -1
  11. data/spec/acceptance_spec.rb +53 -19
  12. data/spec/api_version_spec.rb +4 -2
  13. data/spec/fixtures/v2.4/get-team-by-id.json +1 -0
  14. data/spec/fixtures/v2.4/get-team.json +1 -0
  15. data/spec/fixtures/v2.5/get-league-by-team.json +1 -0
  16. data/spec/fixtures/v2.5/get-league-challenger.json +1 -0
  17. data/spec/fixtures/v2.5/get-league-entry-by-team.json +1 -0
  18. data/spec/fixtures/v2.5/get-league-entry.json +1 -0
  19. data/spec/fixtures/v2.5/get-league.json +1 -0
  20. data/spec/lol/champion_request_spec.rb +8 -11
  21. data/spec/lol/game_request_spec.rb +8 -9
  22. data/spec/lol/league_request_spec.rb +69 -6
  23. data/spec/lol/league_spec.rb +1 -1
  24. data/spec/lol/mastery_page_spec.rb +1 -1
  25. data/spec/lol/match_history_request_spec.rb +7 -0
  26. data/spec/lol/match_request_spec.rb +7 -0
  27. data/spec/lol/request_spec.rb +9 -9
  28. data/spec/lol/rune_page_spec.rb +1 -1
  29. data/spec/lol/static_request_spec.rb +16 -38
  30. data/spec/lol/stats_request_spec.rb +53 -39
  31. data/spec/lol/summoner_request_spec.rb +25 -37
  32. data/spec/lol/team_request_spec.rb +18 -28
  33. data/spec/spec_helper.rb +4 -38
  34. data/spec/support/helpers.rb +47 -0
  35. metadata +24 -30
  36. data/spec/fixtures/v1.1/get-champion.json +0 -1512
  37. data/spec/fixtures/v1.2/get-ranked_stats.json +0 -1448
  38. data/spec/fixtures/v1.2/get-stats.json +0 -115
  39. data/spec/fixtures/v1.3/get-summoner-by-name.json +0 -16
  40. data/spec/fixtures/v1.3/get-summoner-masteries.json +0 -2316
  41. data/spec/fixtures/v1.3/get-summoner-name.json +0 -4
  42. data/spec/fixtures/v1.3/get-summoner-runes.json +0 -6374
  43. data/spec/fixtures/v1.3/get-summoner.json +0 -16
  44. data/spec/fixtures/v2.2/get-team.json +0 -678
  45. data/spec/fixtures/v2.2/getbyid-team.json +0 -286
  46. data/spec/fixtures/v2.3/get-league.json +0 -1470
  47. data/spec/fixtures/v2.3/get-team.json +0 -1
  48. data/spec/fixtures/v2.3/getbyid-team.json +0 -1
  49. data/spec/fixtures/v2.4/get-league.json +0 -1
@@ -23,7 +23,7 @@ describe League do
23
23
  end
24
24
 
25
25
  it "fills entries with LeagueEntry objects" do
26
- league_data = load_fixture("league", LeagueRequest.api_version, "get")
26
+ league_data = load_fixture("league", LeagueRequest.api_version)
27
27
  league = League.new(league_data[league_data.keys.first].first)
28
28
  expect(league.entries.map(&:class).uniq).to eq([LeagueEntry])
29
29
  end
@@ -16,7 +16,7 @@ describe MasteryPage do
16
16
  end
17
17
 
18
18
  describe "#masteries" do
19
- let(:fixture) { load_fixture("summoner-masteries", SummonerRequest.api_version, "get") }
19
+ let(:fixture) { load_fixture("summoner-masteries", SummonerRequest.api_version) }
20
20
  let(:masteries) { fixture["30743211"]["pages"].first["masteries"] }
21
21
 
22
22
  subject { MasteryPage.new fixture["30743211"]["pages"].first }
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+ require "lol"
3
+
4
+ include Lol
5
+
6
+ describe MatchHistoryRequest do
7
+ end
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+ require "lol"
3
+
4
+ include Lol
5
+
6
+ describe MatchRequest do
7
+ end
@@ -36,19 +36,19 @@ describe Request do
36
36
 
37
37
  it "calls HTTParty get" do
38
38
  expect(subject.class).to receive(:get).and_return(error401)
39
- expect { subject.perform_request "foo"}.to raise_error(InvalidAPIResponse)
39
+ expect { subject.perform_request "foo?api_key=asd"}.to raise_error(InvalidAPIResponse)
40
40
  end
41
41
 
42
42
  it "handles 401" do
43
43
  expect(subject.class).to receive(:get).and_return(error401)
44
- expect { subject.perform_request "foo" }.to raise_error(InvalidAPIResponse)
44
+ expect { subject.perform_request "foo?api_key=asd" }.to raise_error(InvalidAPIResponse)
45
45
  end
46
46
 
47
47
  it "handles 404" do
48
48
  expect(error401).to receive(:respond_to?).and_return(true)
49
49
  expect(error401).to receive(:not_found?).and_return(true)
50
50
  expect(subject.class).to receive(:get).and_return(error401)
51
- expect { subject.perform_request "foo"}.to raise_error(NotFound)
51
+ expect { subject.perform_request "foo?api_key=asd"}.to raise_error(NotFound)
52
52
  end
53
53
 
54
54
  context "caching" do
@@ -74,27 +74,27 @@ describe Request do
74
74
  let(:fake_redis) { FakeRedis.new }
75
75
  let(:request) { Request.new "api_key", "euw", {redis: fake_redis, ttl: 60, cached: true }}
76
76
  before :each do
77
- expect(request.class).to receive(:get).with("/foo").and_return({foo: "bar"}).at_least(:once)
78
- first_result = request.perform_request "/foo"
77
+ expect(request.class).to receive(:get).with("/foo?api_key=asd").and_return({foo: "bar"}).at_least(:once)
78
+ first_result = request.perform_request "/foo?api_key=asd"
79
79
  end
80
80
 
81
81
  it "is cached" do
82
82
  expect(request.class).not_to receive(:get)
83
- request.perform_request "/foo"
83
+ request.perform_request "/foo?api_key=asd"
84
84
  end
85
85
 
86
86
  it "serializes cached responses" do
87
87
  expect(JSON).to receive(:parse)
88
- request.perform_request "/foo"
88
+ request.perform_request "/foo?api_key=asd"
89
89
  end
90
90
 
91
91
  it "sets ttl" do
92
- expect(fake_redis.get("/foo:ttl")).to eq(60)
92
+ expect(fake_redis.get("/foo?:ttl")).to eq(60)
93
93
  end
94
94
 
95
95
  it "uses clean urls" do
96
96
  expect(request).to receive(:clean_url).at_least(:once)
97
- request.perform_request "/foo"
97
+ request.perform_request "/foo?api_key=asd"
98
98
  end
99
99
  end
100
100
  end
@@ -16,7 +16,7 @@ describe RunePage do
16
16
  end
17
17
 
18
18
  describe "#slots" do
19
- let(:fixture) { load_fixture("summoner-runes", SummonerRequest.api_version, "get") }
19
+ let(:fixture) { load_fixture("summoner-runes", SummonerRequest.api_version) }
20
20
  let(:slots) { fixture["30743211"]["pages"].first["slots"] }
21
21
 
22
22
  subject { RunePage.new fixture["30743211"]["pages"].first }
@@ -10,9 +10,9 @@ describe StaticRequest do
10
10
  end
11
11
  end
12
12
 
13
- let(:request) { StaticRequest.new "api_key", "euw" }
13
+ let(:request) { StaticRequest.new("api_key", "euw") }
14
14
 
15
- describe "api_url" do
15
+ describe "#api_url" do
16
16
  it "contains a static-data path component" do
17
17
  expect(request.api_url("foo")).to eq("http://global.api.pvp.net/api/lol/static-data/euw/v1.2/foo?api_key=api_key")
18
18
  end
@@ -32,18 +32,13 @@ describe StaticRequest do
32
32
  end
33
33
 
34
34
  context "without_id" do
35
- let(:fixtures) do
36
- fixture = endpoint == 'champion' && 'static-champion' || endpoint.dasherize
37
- load_fixture(fixture, StaticRequest.api_version, "get")
38
- end
39
35
 
40
- subject do
41
- expect(request).to receive(:perform_request)
42
- .with(request.api_url("#{endpoint.dasherize}"))
43
- .and_return(fixtures)
36
+ let(:fixture_name) { endpoint == 'champion' ? 'static-champion' : endpoint.dasherize }
37
+ let(:fixture) { load_fixture(fixture_name, StaticRequest.api_version) }
44
38
 
45
- request.send(endpoint).get
46
- end
39
+ subject { request.public_send(endpoint).get }
40
+
41
+ before(:each) { stub_request(request, fixture_name, "#{endpoint.dasherize}") }
47
42
 
48
43
  it "returns an Array" do
49
44
  expect(subject).to be_an(Array)
@@ -54,21 +49,16 @@ describe StaticRequest do
54
49
  end
55
50
 
56
51
  it "fetches #{endpoint} from the API" do
57
- expect(subject.size).to eq(fixtures["data"].size)
52
+ expect(subject.size).to eq(fixture["data"].size)
58
53
  end
59
54
  end
60
55
 
61
56
  context "with_id" do
62
57
  let(:id) { 1 }
63
- let(:fixtures) { load_fixture("#{endpoint.dasherize}-by-id", StaticRequest.api_version, "get") }
64
58
 
65
- subject do
66
- expect(request).to receive(:perform_request)
67
- .with(request.api_url("#{endpoint.dasherize}/#{id}"))
68
- .and_return(fixtures)
59
+ before(:each) { stub_request(request, "#{endpoint.dasherize}-by-id", "#{endpoint.dasherize}/#{id}") }
69
60
 
70
- request.send(endpoint).get(id)
71
- end
61
+ subject { request.public_send(endpoint).get(id) }
72
62
 
73
63
  it "returns an OpenStruct" do
74
64
  expect(subject).to be_an(OpenStruct)
@@ -78,32 +68,20 @@ describe StaticRequest do
78
68
  end
79
69
  end
80
70
 
81
- describe "realm" do
82
- let(:fixtures) { load_fixture("realm", StaticRequest.api_version, "get") }
71
+ describe "#realm" do
72
+ subject { request.realm.get }
83
73
 
84
- subject do
85
- expect(request).to receive(:perform_request)
86
- .with(request.api_url("realm"))
87
- .and_return(fixtures)
88
-
89
- request.send("realm").get
90
- end
74
+ before(:each) { stub_request(request, 'realm', 'realm') }
91
75
 
92
76
  it "returns an OpenStruct" do
93
77
  expect(subject).to be_an(OpenStruct)
94
78
  end
95
79
  end
96
80
 
97
- describe "versions" do
98
- let(:fixtures) { load_fixture("versions", StaticRequest.api_version, "get") }
81
+ describe "#versions" do
82
+ subject { request.versions.get }
99
83
 
100
- subject do
101
- expect(request).to receive(:perform_request)
102
- .with(request.api_url("versions"))
103
- .and_return(fixtures)
104
-
105
- request.send("versions").get
106
- end
84
+ before(:each) { stub_request(request, 'versions', 'versions') }
107
85
 
108
86
  it "returns an Array" do
109
87
  expect(subject).to be_an(Array)
@@ -4,76 +4,90 @@ require "lol"
4
4
  include Lol
5
5
 
6
6
  describe StatsRequest do
7
- let(:request) { StatsRequest.new "api_key", "euw" }
7
+ let(:request) { StatsRequest.new("api_key", "euw") }
8
8
 
9
9
  it "inherits from Request" do
10
10
  expect(GameRequest.ancestors[1]).to eq(Request)
11
11
  end
12
12
 
13
13
  describe "#summary" do
14
- let(:fixture) { load_fixture 'stats', StatsRequest.api_version, 'get' }
15
-
16
- subject do
17
- expect(request.class).to receive(:get).with(request.api_url("stats/by-summoner/1/summary")).and_return fixture
18
-
19
- request.summary 1
20
- end
21
14
 
22
15
  it 'requires a summoner' do
23
16
  expect { request.summary }.to raise_error ArgumentError
24
17
  end
25
18
 
26
- it 'returns an array' do
27
- expect(subject).to be_a Array
19
+ it 'raises an error when unexpected parameter is received' do
20
+ expect { request.summary '1', asd: 'foo' }.to raise_error ArgumentError
28
21
  end
29
22
 
30
- it 'returns an array of PlayerStatistic' do
31
- expect(subject.map(&:class).uniq).to eq [PlayerStatistic]
32
- end
23
+ context 'with summoner' do
24
+ subject { request.summary(1) }
33
25
 
34
- it 'fetches PlayerStatistics from the API' do
35
- expect(subject.size).to eq load_fixture('stats', StatsRequest.api_version, 'get')['playerStatSummaries'].size
36
- end
26
+ context 'without season' do
27
+ let(:fixture) { load_fixture('stats', StatsRequest.api_version) }
37
28
 
38
- it 'optionally accepts a season' do
39
- expect(request.class).to receive(:get).with(request.api_url('stats/by-summoner/1/summary', season: '1')).and_return fixture
40
- request.summary '1', season: '1'
41
- end
29
+ before(:each) { stub_request(request, 'stats', 'stats/by-summoner/1/summary') }
30
+
31
+ it 'returns an array' do
32
+ expect(subject).to be_a Array
33
+ end
34
+
35
+ it 'returns an array of PlayerStatistic' do
36
+ expect(subject.map(&:class).uniq).to eq [PlayerStatistic]
37
+ end
38
+
39
+ it 'fetches PlayerStatistics from the API' do
40
+ expect(subject.size).to eq(fixture['playerStatSummaries'].size)
41
+ end
42
+ end
43
+
44
+ context 'with season' do
45
+ before(:each) { stub_request(request, 'stats', 'stats/by-summoner/1/summary', season: '1') }
46
+
47
+ it 'optionally accepts a season' do
48
+ request.summary('1', season: '1')
49
+ end
50
+ end
42
51
 
43
- it 'raises an error when unexpected parameter is received' do
44
- expect { request.summary '1', asd: 'foo' }.to raise_error ArgumentError
45
52
  end
46
53
  end
47
54
 
48
55
  describe "#ranked" do
49
- let(:fixture) { load_fixture 'ranked_stats', StatsRequest.api_version, 'get' }
50
-
51
- subject do
52
- expect(request.class).to receive(:get).with(request.api_url("stats/by-summoner/1/ranked")).and_return fixture
53
- request.ranked 1
54
- end
55
56
 
56
57
  it 'requires a summoner' do
57
58
  expect { request.ranked }.to raise_error ArgumentError
58
59
  end
59
60
 
60
- it 'returns a RankedStatisticsSummary' do
61
- expect(subject).to be_a RankedStatisticsSummary
61
+ it 'raises an error when unexpected parameter is received' do
62
+ expect { request.ranked '1', asd: 'foo' }.to raise_error ArgumentError
62
63
  end
63
64
 
64
- it 'fetches RankedStatisticsSummary from the API' do
65
- expect(subject.champions.size).to eq load_fixture('ranked_stats', StatsRequest.api_version, 'get')['champions'].size
66
- end
65
+ context 'with summoner' do
66
+ let(:fixture) { load_fixture('ranked_stats', StatsRequest.api_version) }
67
67
 
68
- it 'optionally accepts a season' do
69
- expect(request.class).to receive(:get).with(request.api_url('stats/by-summoner/1/ranked', season: '1')).and_return fixture
68
+ context 'without season' do
69
+ subject { request.ranked(1) }
70
70
 
71
- request.ranked '1', season: '1'
72
- end
71
+ before(:each) { stub_request(request, 'ranked_stats', 'stats/by-summoner/1/ranked') }
73
72
 
74
- it 'raises an error when unexpected parameter is received' do
75
- expect { request.ranked '1', asd: 'foo' }.to raise_error ArgumentError
73
+ it 'returns a RankedStatisticsSummary' do
74
+ expect(subject).to be_a RankedStatisticsSummary
75
+ end
76
+
77
+ it 'fetches RankedStatisticsSummary from the API' do
78
+ expect(subject.champions.size).to eq(fixture['champions'].size)
79
+ end
80
+ end
81
+
82
+ context 'with season' do
83
+ before(:each) { stub_request(request, 'ranked_stats', 'stats/by-summoner/1/ranked', season: '1') }
84
+
85
+ it 'optionally accepts a season' do
86
+ request.ranked('1', season: '1')
87
+ end
88
+ end
76
89
  end
90
+
77
91
  end
78
92
 
79
93
  end
@@ -8,50 +8,44 @@ describe SummonerRequest do
8
8
  expect(SummonerRequest.ancestors[1]).to eq(Request)
9
9
  end
10
10
 
11
- let(:request) { SummonerRequest.new "api_key", "euw" }
12
- let(:by_name) { load_fixture("summoner-by-name", SummonerRequest.api_version, "get") }
13
- let(:name) { load_fixture("summoner-name", SummonerRequest.api_version, "get") }
14
- let(:summoner) { load_fixture("summoner", SummonerRequest.api_version, "get") }
15
- let(:runes) { load_fixture("summoner-runes", SummonerRequest.api_version, "get") }
16
- let(:masteries) { load_fixture("summoner-masteries", SummonerRequest.api_version, "get") }
11
+ let(:request) { SummonerRequest.new('api_key', 'euw') }
17
12
 
18
13
  describe "#by_name" do
19
- subject do
20
- expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/foo,bar")).and_return(by_name)
21
14
 
22
- request.by_name ["foo", "bar"]
23
- end
15
+ context 'regular arguments' do
16
+ subject { request.by_name(['foo', 'bar']) }
24
17
 
25
- it "returns an array" do
26
- expect(subject).to be_a(Array)
27
- end
18
+ before(:each) { stub_request(request, 'summoner-by-name', 'summoner/by-name/foo,bar') }
28
19
 
29
- it "returns an array of summoners" do
30
- expect(subject.map(&:class).uniq).to eq([Summoner])
20
+ it "returns an array" do
21
+ expect(subject).to be_a(Array)
22
+ end
23
+
24
+ it "returns an array of summoners" do
25
+ expect(subject.map(&:class).uniq).to eq([Summoner])
26
+ end
31
27
  end
32
28
 
33
29
  it 'escapes the given names' do
34
- expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/f%C3%B2%C3%A5,f%C3%B9%C3%AE")).and_return(by_name)
35
- request.by_name ['fòå', 'fùî']
30
+ stub_request(request, 'summoner-by-name', "summoner/by-name/f%C3%B2%C3%A5,f%C3%B9%C3%AE")
31
+ request.by_name(['fòå', 'fùî'])
36
32
  end
37
33
 
38
34
  it 'downcase the given names' do
39
- expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/foo,bar")).and_return(by_name)
40
- request.by_name 'FoO', 'BAR'
35
+ stub_request(request, 'summoner-by-name', 'summoner/by-name/foo,bar')
36
+ request.by_name('FoO', 'BAR')
41
37
  end
42
38
 
43
39
  it 'strips spaces from names' do
44
- expect(request.class).to receive(:get).with(request.api_url("summoner/by-name/foo,bar")).and_return(by_name)
45
- request.by_name 'Fo o', 'b a r'
40
+ stub_request(request, 'summoner-by-name', 'summoner/by-name/foo,bar')
41
+ request.by_name('Fo o', 'b a r')
46
42
  end
47
43
  end
48
44
 
49
45
  describe "#name" do
50
- subject do
51
- expect(request.class).to receive(:get).with(request.api_url("summoner/foo,bar/name")).and_return(name)
46
+ subject { request.name("foo", "bar") }
52
47
 
53
- request.name "foo", "bar"
54
- end
48
+ before(:each) { stub_request(request, 'summoner-name', 'summoner/foo,bar/name') }
55
49
 
56
50
  it "returns an hash" do
57
51
  expect(subject).to be_a(Hash)
@@ -59,11 +53,9 @@ describe SummonerRequest do
59
53
  end
60
54
 
61
55
  describe "#get" do
62
- subject do
63
- expect(request.class).to receive(:get).with(request.api_url("summoner/foo,bar")).and_return(summoner)
56
+ subject { request.get(["foo", "bar"]) }
64
57
 
65
- request.get ["foo", "bar"]
66
- end
58
+ before(:each) { stub_request(request, 'summoner', 'summoner/foo,bar') }
67
59
 
68
60
  it "returns an array summoners" do
69
61
  expect(subject.map(&:class).uniq).to eq([Summoner])
@@ -71,11 +63,9 @@ describe SummonerRequest do
71
63
  end
72
64
 
73
65
  describe "#runes" do
74
- subject do
75
- expect(request.class).to receive(:get).with(request.api_url("summoner/foo,bar/runes")).and_return(runes)
66
+ subject { request.runes(["foo", "bar"]) }
76
67
 
77
- request.runes ["foo", "bar"]
78
- end
68
+ before(:each) { stub_request(request, 'summoner-runes', 'summoner/foo,bar/runes') }
79
69
 
80
70
  it "returns an array of Hash" do
81
71
  expect(subject).to be_a(Hash)
@@ -87,11 +77,9 @@ describe SummonerRequest do
87
77
  end
88
78
 
89
79
  describe "#masteries" do
90
- subject do
91
- expect(request.class).to receive(:get).with(request.api_url("summoner/foo,bar/masteries")).and_return(masteries)
80
+ subject { request.masteries(["foo", "bar"]) }
92
81
 
93
- request.masteries ["foo", "bar"]
94
- end
82
+ before(:each) { stub_request(request, 'summoner-masteries', 'summoner/foo,bar/masteries') }
95
83
 
96
84
  it "returns an array of Hash" do
97
85
  expect(subject).to be_a(Hash)
@@ -4,54 +4,44 @@ require "lol"
4
4
  include Lol
5
5
 
6
6
  describe TeamRequest do
7
- let(:request) { TeamRequest.new "api_key", "euw" }
7
+ let(:request) { TeamRequest.new("api_key", "euw") }
8
8
 
9
9
  it "inherits from Request" do
10
10
  expect(TeamRequest.ancestors[1]).to eq(Request)
11
11
  end
12
12
 
13
- describe "get" do
14
- let(:request) { TeamRequest.new "api_key", "euw" }
15
- let(:fixture) { load_fixture 'team', TeamRequest.api_version, 'get' }
13
+ describe "#by_summoner" do
14
+ let(:fixture) { load_fixture('team', TeamRequest.api_version) }
16
15
 
17
- subject do
18
- expect(request.class).to receive(:get).with(request.api_url("team/by-summoner/1")).and_return fixture
19
- request.get 1
20
- end
16
+ subject { request.by_summoner(1) }
21
17
 
22
- it 'returns an hash' do
23
- expect(subject).to be_a Hash
24
- end
18
+ before(:each) { stub_request(request, 'team', 'team/by-summoner/1') }
25
19
 
26
- it 'returns an array of Team' do
27
- expect(subject[subject.keys.first].map(&:class).uniq).to eq [Team]
20
+ it 'returns an hash' do
21
+ expect(subject).to be_a(Hash)
28
22
  end
29
23
 
30
24
  it 'fetches Team from the API' do
31
- expect(subject.size).to eq fixture.size
25
+ expect(subject.size).to eq(fixture.size)
32
26
  end
33
27
  end
34
28
 
35
- describe "getbyid" do
36
- let(:request) { TeamRequest.new "api_key", "euw" }
37
- let(:fixture) { load_fixture 'team', TeamRequest.api_version, 'getbyid' }
29
+ describe "#get" do
38
30
 
39
- subject do
40
- expect(request.class).to receive(:get).with(request.api_url("team/TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a")).and_return fixture
41
- request.getbyid "TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a"
31
+ it 'requires a team id' do
32
+ expect { request.get }.to raise_error
42
33
  end
43
34
 
44
- it 'requires a summoner' do
45
- expect { request.getbyid }.to raise_error ArgumentError
46
- end
35
+ context 'with team id' do
36
+ subject { request.get("TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a") }
47
37
 
48
- it 'returns a Team' do
49
- expect(subject).to be_a Lol::Team
50
- end
38
+ before(:each) { stub_request(request, 'team-by-id', 'team/TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a') }
51
39
 
52
- it 'fetches Team from the API' do
53
- expect(subject.full_id).to eq "TEAM-a9ad3db0-b377-11e3-b87d-782bcb4ce61a"
40
+ it 'returns an array of Teams' do
41
+ subject.each {|k,v| expect(v).to be_a Lol::Team}
42
+ end
54
43
  end
44
+
55
45
  end
56
46
 
57
47
  end