bnet_scraper 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +51 -31
- data/bnet_scraper.gemspec +3 -1
- data/fixtures/vcr_cassettes/demon_achievements.yml +246 -0
- data/fixtures/vcr_cassettes/demon_leagues.yml +359 -0
- data/fixtures/vcr_cassettes/demon_match_history.yml +241 -0
- data/fixtures/vcr_cassettes/demon_matches.yml +240 -0
- data/fixtures/vcr_cassettes/demon_profile.yml +1428 -0
- data/fixtures/vcr_cassettes/demon_profile_leagues.yml +1291 -0
- data/fixtures/vcr_cassettes/full_demon_scrape.yml +5449 -0
- data/fixtures/vcr_cassettes/invalid_achievement.yml +199 -0
- data/fixtures/vcr_cassettes/invalid_leagues.yml +199 -0
- data/fixtures/vcr_cassettes/invalid_matches.yml +199 -0
- data/fixtures/vcr_cassettes/invalid_profile.yml +199 -0
- data/fixtures/vcr_cassettes/new_league.yml +595 -0
- data/fixtures/vcr_cassettes/profile_invalid.yml +199 -0
- data/fixtures/vcr_cassettes/profile_not_laddered.yml +443 -0
- data/fixtures/vcr_cassettes/realm_status.yml +578 -0
- data/lib/bnet_scraper/starcraft2.rb +7 -8
- data/lib/bnet_scraper/starcraft2/achievement_scraper.rb +5 -5
- data/lib/bnet_scraper/starcraft2/league.rb +54 -0
- data/lib/bnet_scraper/starcraft2/league_scraper.rb +3 -1
- data/lib/bnet_scraper/starcraft2/match.rb +15 -0
- data/lib/bnet_scraper/starcraft2/match_history_scraper.rb +9 -18
- data/lib/bnet_scraper/starcraft2/profile.rb +45 -0
- data/lib/bnet_scraper/starcraft2/profile_scraper.rb +68 -44
- data/spec/spec_helper.rb +14 -0
- data/spec/starcraft2/achievement_scraper_spec.rb +67 -83
- data/spec/starcraft2/league_scraper_spec.rb +25 -59
- data/spec/starcraft2/league_spec.rb +43 -0
- data/spec/starcraft2/match_history_scraper_spec.rb +19 -39
- data/spec/starcraft2/profile_scraper_spec.rb +36 -141
- data/spec/starcraft2/profile_spec.rb +46 -0
- data/spec/starcraft2/status_scraper_spec.rb +12 -5
- data/spec/starcraft2_spec.rb +19 -36
- data/spec/support/shared/sc2_scraper.rb +28 -13
- metadata +57 -42
- data/spec/support/achievements.html +0 -1156
- data/spec/support/failure.html +0 -565
- data/spec/support/initial_league.html +0 -1082
- data/spec/support/initial_leagues.html +0 -3598
- data/spec/support/league.html +0 -8310
- data/spec/support/leagues.html +0 -3810
- data/spec/support/load_fakeweb.rb +0 -42
- data/spec/support/matches.html +0 -1228
- data/spec/support/no_ladder.html +0 -967
- data/spec/support/no_ladder_leagues.html +0 -664
- data/spec/support/profile.html +0 -1074
- data/spec/support/status.html +0 -1
@@ -1,77 +1,43 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe BnetScraper::Starcraft2::LeagueScraper do
|
4
|
-
let(:url) { "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/
|
4
|
+
let(:url) { "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/134659" }
|
5
5
|
subject { BnetScraper::Starcraft2::LeagueScraper.new(url: url) }
|
6
6
|
|
7
7
|
it_behaves_like 'an SC2 Scraper' do
|
8
8
|
let(:scraper_class) { BnetScraper::Starcraft2::LeagueScraper }
|
9
|
-
let(:subject) { scraper_class.new(url: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/
|
9
|
+
let(:subject) { scraper_class.new(url: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/134659") }
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#initialize' do
|
13
13
|
it 'should dissect the league_id from the URL' do
|
14
|
-
subject.league_id.should == '
|
14
|
+
subject.league_id.should == '134659'
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#scrape' do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should set if player is random' do
|
44
|
-
subject.random.should be_nil
|
45
|
-
subject.scrape
|
46
|
-
subject.random.should be_false
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should call output' do
|
50
|
-
subject.should_receive(:output)
|
51
|
-
subject.scrape
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should raise InvalidProfileError when response is 404' do
|
55
|
-
url = 'http://us.battle.net/sc2/en/profile/2377239/1/SomeDude/leagues/12345'
|
56
|
-
scraper = BnetScraper::Starcraft2::LeagueScraper.new(url: url)
|
57
|
-
expect { scraper.scrape }.to raise_error(BnetScraper::InvalidProfileError)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe '#output' do
|
62
|
-
it 'should return a hash of league data' do
|
63
|
-
expected = {
|
64
|
-
season: '6',
|
65
|
-
name: 'Aleksander Pepper',
|
66
|
-
division: 'Diamond',
|
67
|
-
size: '4v4',
|
68
|
-
random: false,
|
69
|
-
bnet_id: '2377239',
|
70
|
-
account: 'Demon'
|
71
|
-
}
|
72
|
-
|
73
|
-
subject.scrape
|
74
|
-
subject.output.should == expected
|
19
|
+
context 'valid profile' do
|
20
|
+
before do
|
21
|
+
VCR.use_cassette('demon_leagues') do
|
22
|
+
subject.scrape
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
its(:season) { should == '2013 Season 1' }
|
27
|
+
its(:name) { should == 'Kalathi Echo' }
|
28
|
+
its(:division) { should == 'Platinum' }
|
29
|
+
its(:size) { should == '1v1' }
|
30
|
+
its(:random) { should be_false }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'invalid profile' do
|
34
|
+
it 'should raise InvalidProfileError' do
|
35
|
+
VCR.use_cassette('invalid_leagues') do
|
36
|
+
url = 'http://us.battle.net/sc2/en/profile/2377239/1/SomeDude/leagues/12345'
|
37
|
+
scraper = BnetScraper::Starcraft2::LeagueScraper.new(url: url)
|
38
|
+
expect { scraper.scrape }.to raise_error(BnetScraper::InvalidProfileError)
|
39
|
+
end
|
40
|
+
end
|
75
41
|
end
|
76
42
|
end
|
77
43
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetScraper::Starcraft2::League do
|
4
|
+
let(:href) { 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/134659' }
|
5
|
+
let(:league) { BnetScraper::Starcraft2::League.new href: href }
|
6
|
+
subject { league }
|
7
|
+
|
8
|
+
it 'scrapes if name is not set' do
|
9
|
+
VCR.use_cassette('demon_leagues') do
|
10
|
+
league.name.should == 'Kalathi Echo'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'scrapes if season is not set' do
|
15
|
+
VCR.use_cassette('demon_leagues') do
|
16
|
+
league.season.should == '2013 Season 1'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'scrapes if division is not set' do
|
21
|
+
VCR.use_cassette('demon_leagues') do
|
22
|
+
league.division.should == 'Platinum'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'scrapes if size is not set' do
|
27
|
+
VCR.use_cassette('demon_leagues') do
|
28
|
+
league.size.should == '1v1'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'scrapes if bnet_id is not set' do
|
33
|
+
VCR.use_cassette('demon_leagues') do
|
34
|
+
league.bnet_id.should == '2377239'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'scrapes if account is not set' do
|
39
|
+
VCR.use_cassette('demon_leagues') do
|
40
|
+
league.account.should == 'Demon'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe BnetScraper::Starcraft2::MatchHistoryScraper do
|
4
4
|
let(:url) { 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/matches' }
|
5
|
-
|
5
|
+
let(:scraper) { BnetScraper::Starcraft2::MatchHistoryScraper.new(url: url) }
|
6
|
+
subject { scraper }
|
6
7
|
|
7
8
|
it_behaves_like 'an SC2 Scraper' do
|
8
9
|
let(:scraper_class) { BnetScraper::Starcraft2::MatchHistoryScraper }
|
@@ -11,49 +12,28 @@ describe BnetScraper::Starcraft2::MatchHistoryScraper do
|
|
11
12
|
|
12
13
|
describe '#scrape' do
|
13
14
|
|
14
|
-
before
|
15
|
-
|
15
|
+
before do
|
16
|
+
VCR.use_cassette('demon_matches') do
|
17
|
+
scraper.scrape
|
18
|
+
end
|
16
19
|
end
|
20
|
+
|
21
|
+
its(:matches) { should have(25).matches }
|
17
22
|
|
18
|
-
|
19
|
-
subject.matches
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should set the type of the match for each match' do
|
27
|
-
subject.matches[0][:type].should == 'Custom'
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should set the outcome of each match' do
|
31
|
-
subject.matches[0][:outcome].should == :win
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should set the match date of each match' do
|
35
|
-
subject.matches[0][:date].should == '3/12/2012'
|
23
|
+
describe 'each match' do
|
24
|
+
subject { scraper.matches[0] }
|
25
|
+
its(:map_name) { should == 'Cloud Kingdom LE' }
|
26
|
+
its(:type) { should == '1v1' }
|
27
|
+
its(:outcome) { should == :win }
|
28
|
+
its(:date) { should == '2/20/2013' }
|
36
29
|
end
|
37
30
|
|
38
31
|
it 'should raised InvalidProfileError when response is 404' do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
describe '#output' do
|
46
|
-
before :each do
|
47
|
-
subject.scrape
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should return a hash of the scraped match data' do
|
51
|
-
expected = {
|
52
|
-
matches: subject.matches,
|
53
|
-
wins: subject.wins,
|
54
|
-
losses: subject.losses
|
55
|
-
}
|
56
|
-
subject.output.should == expected
|
32
|
+
VCR.use_cassette('invalid_matches') do
|
33
|
+
url = 'http://us.battle.net/sc2/en/profile/2377239/1/SomeDude/matches'
|
34
|
+
scraper = BnetScraper::Starcraft2::MatchHistoryScraper.new(url: url)
|
35
|
+
expect { scraper.scrape }.to raise_error(BnetScraper::InvalidProfileError)
|
36
|
+
end
|
57
37
|
end
|
58
38
|
end
|
59
39
|
end
|
@@ -6,73 +6,70 @@ describe BnetScraper::Starcraft2::ProfileScraper do
|
|
6
6
|
let(:subject) { scraper_class.new(url: 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/') }
|
7
7
|
end
|
8
8
|
|
9
|
-
|
9
|
+
let(:scraper) { BnetScraper::Starcraft2::ProfileScraper.new(bnet_id: '2377239', account: 'Demon') }
|
10
10
|
|
11
11
|
describe '#get_profile_data' do
|
12
12
|
before do
|
13
|
-
|
13
|
+
VCR.use_cassette('demon_profile', record: :new_episodes) do
|
14
|
+
scraper.get_profile_data
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
its(:
|
18
|
+
subject { scraper.profile }
|
19
|
+
|
20
|
+
its(:achievement_points) { should == '3680' }
|
21
|
+
its(:current_solo_league) { should == 'Platinum' }
|
19
22
|
its(:highest_solo_league) { should == 'Platinum' }
|
20
|
-
its(:current_team_league) { should == '
|
21
|
-
its(:highest_team_league) { should == '
|
22
|
-
its(:career_games) { should == '
|
23
|
-
its(:games_this_season) { should == '
|
24
|
-
its(:
|
23
|
+
its(:current_team_league) { should == 'Diamond' }
|
24
|
+
its(:highest_team_league) { should == 'Master' }
|
25
|
+
its(:career_games) { should == '1719' }
|
26
|
+
its(:games_this_season) { should == '114' }
|
27
|
+
its(:portrait) { should == 'Mohandar' }
|
28
|
+
its(:terran_swarm_level) { should == 0 }
|
29
|
+
its(:protoss_swarm_level) { should == 0 }
|
30
|
+
its(:zerg_swarm_level) { should == 0 }
|
25
31
|
|
26
32
|
context 'first league ever' do
|
27
|
-
|
33
|
+
let(:scraper) { BnetScraper::Starcraft2::ProfileScraper.new url: 'http://us.battle.net/sc2/en/profile/3513522/1/Heritic/' }
|
28
34
|
|
29
|
-
|
30
|
-
|
35
|
+
subject do
|
36
|
+
VCR.use_cassette('new_league', record: :new_episodes) do
|
37
|
+
scraper.scrape
|
38
|
+
end
|
31
39
|
end
|
32
40
|
|
33
41
|
its(:current_solo_league) { should == 'Bronze' }
|
34
42
|
its(:highest_solo_league) { should == 'Bronze' }
|
35
|
-
its(:current_team_league) { should == '
|
43
|
+
its(:current_team_league) { should == 'Bronze' }
|
36
44
|
its(:highest_team_league) { should == 'Silver' }
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
40
48
|
describe 'get_league_list' do
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
subject.should have(12).leagues
|
49
|
+
before do
|
50
|
+
VCR.use_cassette('demon_profile_leagues') do
|
51
|
+
scraper.get_league_list
|
52
|
+
end
|
46
53
|
end
|
54
|
+
|
55
|
+
subject { scraper.profile.leagues }
|
56
|
+
it { should have(8).leagues }
|
47
57
|
end
|
48
58
|
|
49
59
|
describe '#scrape' do
|
50
|
-
it 'should call get_profile_data' do
|
51
|
-
subject.should_receive(:get_profile_data)
|
52
|
-
subject.scrape
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should call get_league_list' do
|
56
|
-
subject.should_receive(:get_league_list)
|
57
|
-
subject.scrape
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
it 'should call output' do
|
63
|
-
subject.should_receive(:output)
|
64
|
-
subject.scrape
|
65
|
-
end
|
66
|
-
|
67
60
|
it 'should return InvalidProfileError if response is 404' do
|
68
|
-
|
69
|
-
|
61
|
+
VCR.use_cassette('profile_invalid') do
|
62
|
+
scraper = BnetScraper::Starcraft2::ProfileScraper.new url: 'http://us.battle.net/sc2/en/profile/2377239/1/SomeDude/'
|
63
|
+
expect { scraper.scrape }.to raise_error(BnetScraper::InvalidProfileError)
|
64
|
+
end
|
70
65
|
end
|
71
66
|
|
72
67
|
context 'account that has not laddered' do
|
73
68
|
let(:scraper) {BnetScraper::Starcraft2::ProfileScraper.new(url: 'http://us.battle.net/sc2/en/profile/3354437/1/ClarkeKent/') }
|
74
69
|
before do
|
75
|
-
|
70
|
+
VCR.use_cassette('profile_not_laddered') do
|
71
|
+
scraper.scrape
|
72
|
+
end
|
76
73
|
end
|
77
74
|
|
78
75
|
it 'should have an empty array of leagues' do
|
@@ -80,106 +77,4 @@ describe BnetScraper::Starcraft2::ProfileScraper do
|
|
80
77
|
end
|
81
78
|
end
|
82
79
|
end
|
83
|
-
|
84
|
-
describe '#output' do
|
85
|
-
it 'should extract profile data from the response' do
|
86
|
-
expected = {
|
87
|
-
bnet_id: '2377239',
|
88
|
-
account: 'Demon',
|
89
|
-
bnet_index: 1,
|
90
|
-
race: 'Protoss',
|
91
|
-
career_games: '1568',
|
92
|
-
games_this_season: '0',
|
93
|
-
highest_solo_league: 'Platinum',
|
94
|
-
current_solo_league: 'Not Yet Ranked',
|
95
|
-
highest_team_league: 'Diamond',
|
96
|
-
current_team_league: 'Not Yet Ranked',
|
97
|
-
most_played: '4v4',
|
98
|
-
achievement_points: '3660',
|
99
|
-
portrait: 'Mohandar',
|
100
|
-
leagues: [
|
101
|
-
{
|
102
|
-
name: "1v1 Platinum Rank 95",
|
103
|
-
id: "96905",
|
104
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96905#current-rank"
|
105
|
-
},
|
106
|
-
{
|
107
|
-
name: "2v2 Random Platinum ...",
|
108
|
-
id: "96716",
|
109
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96716#current-rank"
|
110
|
-
},
|
111
|
-
{
|
112
|
-
name: "2v2 Diamond Rank 45",
|
113
|
-
id: "98162",
|
114
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98162#current-rank"
|
115
|
-
},
|
116
|
-
{
|
117
|
-
name: "2v2 Silver Rank 8",
|
118
|
-
id: "97369",
|
119
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97369#current-rank"
|
120
|
-
},
|
121
|
-
{
|
122
|
-
name: "3v3 Random Gold Rank...",
|
123
|
-
id: "96828",
|
124
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96828#current-rank"
|
125
|
-
},
|
126
|
-
{
|
127
|
-
name: "3v3 Diamond Rank 56",
|
128
|
-
id: "97985",
|
129
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97985#current-rank"
|
130
|
-
},
|
131
|
-
{
|
132
|
-
name: "3v3 Silver Rank 5",
|
133
|
-
id: "98523",
|
134
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98523#current-rank"
|
135
|
-
},
|
136
|
-
{
|
137
|
-
name: "3v3 Platinum Rank 88",
|
138
|
-
id: "96863",
|
139
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96863#current-rank"
|
140
|
-
},
|
141
|
-
{
|
142
|
-
name: "3v3 Gold Rank 75",
|
143
|
-
id: "97250",
|
144
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/97250#current-rank"
|
145
|
-
},
|
146
|
-
{
|
147
|
-
name: "4v4 Random Platinum ...",
|
148
|
-
id: "96830",
|
149
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/96830#current-rank"
|
150
|
-
},
|
151
|
-
{
|
152
|
-
name: "4v4 Gold Rank 38",
|
153
|
-
id: "98336",
|
154
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98336#current-rank"
|
155
|
-
},
|
156
|
-
{
|
157
|
-
name: "4v4 Diamond Rank 54",
|
158
|
-
id: "98936",
|
159
|
-
href: "http://us.battle.net/sc2/en/profile/2377239/1/Demon/ladder/98936#current-rank"
|
160
|
-
}
|
161
|
-
]
|
162
|
-
}
|
163
|
-
|
164
|
-
subject.output.should == {
|
165
|
-
bnet_id: '2377239',
|
166
|
-
account: 'Demon',
|
167
|
-
bnet_index: 1,
|
168
|
-
race: nil,
|
169
|
-
career_games: nil,
|
170
|
-
games_this_season: nil,
|
171
|
-
most_played: nil,
|
172
|
-
highest_solo_league: nil,
|
173
|
-
current_solo_league: nil,
|
174
|
-
highest_team_league: nil,
|
175
|
-
current_team_league: nil,
|
176
|
-
achievement_points: nil,
|
177
|
-
leagues: [],
|
178
|
-
portrait: nil
|
179
|
-
}
|
180
|
-
|
181
|
-
subject.scrape
|
182
|
-
subject.output.should == expected
|
183
|
-
end
|
184
|
-
end
|
185
80
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetScraper::Starcraft2::Profile do
|
4
|
+
let(:url) { 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/' }
|
5
|
+
let(:profile) { BnetScraper::Starcraft2::Profile.new url: url }
|
6
|
+
subject { profile }
|
7
|
+
|
8
|
+
its(:swarm_levels) { should be_instance_of Hash }
|
9
|
+
its(:swarm_levels) { should have_key :zerg }
|
10
|
+
its(:swarm_levels) { should have_key :protoss }
|
11
|
+
its(:swarm_levels) { should have_key :terran }
|
12
|
+
|
13
|
+
it 'retrieves achievements when first accessed' do
|
14
|
+
VCR.use_cassette('demon_achievements') do
|
15
|
+
profile.achievements.should have_key(:recent)
|
16
|
+
profile.achievements.should have_key(:showcase)
|
17
|
+
profile.achievements.should have_key(:progress)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'sends recent_achievements to achievements hash' do
|
22
|
+
VCR.use_cassette('demon_achievements') do
|
23
|
+
profile.recent_achievements.should == profile.achievements[:recent]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'sends progress_achievements to achievements hash' do
|
28
|
+
VCR.use_cassette('demon_achievements') do
|
29
|
+
profile.progress_achievements.should == profile.achievements[:progress]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'sends showcase_achievements to achievements hash' do
|
34
|
+
VCR.use_cassette('demon_achievements') do
|
35
|
+
profile.showcase_achievements.should == profile.achievements[:showcase]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'retrieves match history when first accessed' do
|
40
|
+
VCR.use_cassette('demon_match_history') do
|
41
|
+
profile.match_history.should have(25).matches
|
42
|
+
profile.match_history.first.should be_instance_of BnetScraper::Starcraft2::Match
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|