File tree Expand file tree Collapse file tree 5 files changed +4708
-2
lines changed
lib/bnet_scraper/starcraft2 Expand file tree Collapse file tree 5 files changed +4708
-2
lines changed Original file line number Diff line number Diff line change @@ -59,15 +59,23 @@ def get_profile_data
5959
6060 if html . css ( "#best-finish-SOLO div" ) [ 0 ]
6161 @highest_solo_league = html . css ( "#best-finish-SOLO div" ) [ 0 ] . children [ 2 ] . inner_text . strip
62- @current_solo_league = html . css ( "#best-finish-SOLO div" ) [ 0 ] . children [ 8 ] . inner_text . strip
62+ if html . css ( "#best-finish-SOLO div" ) [ 0 ] . children [ 8 ]
63+ @current_solo_league = html . css ( "#best-finish-SOLO div" ) [ 0 ] . children [ 8 ] . inner_text . strip
64+ else
65+ @current_solo_league = html . css ( "#best-finish-SOLO div" ) [ 0 ] . children [ 5 ] . inner_text . strip
66+ end
6367 else
6468 @highest_solo_league = "Not Yet Ranked"
6569 @current_solo_league = "Not Yet Ranked"
6670 end
6771
6872 if html . css ( "#best-finish-TEAM div" ) [ 0 ]
6973 @highest_team_league = html . css ( "#best-finish-TEAM div" ) [ 0 ] . children [ 2 ] . inner_text . strip
70- @current_team_league = html . css ( "#best-finish-TEAM div" ) [ 0 ] . children [ 8 ] . inner_text . strip
74+ if html . css ( "#best-finish-TEAM div" ) [ 0 ] . children [ 8 ]
75+ @current_team_league = html . css ( "#best-finish-TEAM div" ) [ 0 ] . children [ 8 ] . inner_text . strip
76+ else
77+ @current_team_league = html . css ( "#best-finish-TEAM div" ) [ 0 ] . children [ 5 ] . inner_text . strip
78+ end
7179 else
7280 @highest_team_league = "Not Yet Ranked"
7381 @current_team_league = "Not Yet Ranked"
Original file line number Diff line number Diff line change 2222 its ( :career_games ) { should == '1568' }
2323 its ( :games_this_season ) { should == '0' }
2424 its ( :most_played ) { should == '4v4' }
25+
26+ context 'first league ever' do
27+ subject { BnetScraper ::Starcraft2 ::ProfileScraper . new url : 'http://us.battle.net/sc2/en/profile/3513522/1/Heritic/' }
28+
29+ before do
30+ subject . scrape
31+ end
32+
33+ its ( :current_solo_league ) { should == 'Bronze' }
34+ its ( :highest_solo_league ) { should == 'Bronze' }
35+ its ( :current_team_league ) { should == 'Silver' }
36+ its ( :highest_team_league ) { should == 'Silver' }
37+ end
2538 end
2639
2740 describe 'get_league_list' do
You can’t perform that action at this time.
0 commit comments