quakelive_api 0.0.1 → 0.1.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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -2
  4. data/CHANGELOG.md +11 -0
  5. data/README.md +6 -2
  6. data/lib/quakelive_api/base.rb +23 -23
  7. data/lib/quakelive_api/game_time.rb +5 -5
  8. data/lib/quakelive_api/parser/awards.rb +21 -21
  9. data/lib/quakelive_api/parser/base.rb +1 -1
  10. data/lib/quakelive_api/parser/statistics.rb +17 -17
  11. data/lib/quakelive_api/parser/summary.rb +25 -24
  12. data/lib/quakelive_api/profile/awards/base.rb +10 -10
  13. data/lib/quakelive_api/profile/awards/career_milestones.rb +1 -1
  14. data/lib/quakelive_api/profile/awards/experience.rb +1 -1
  15. data/lib/quakelive_api/profile/awards/mad_skillz.rb +1 -1
  16. data/lib/quakelive_api/profile/awards/social_life.rb +4 -5
  17. data/lib/quakelive_api/profile/awards/sweet_success.rb +1 -1
  18. data/lib/quakelive_api/profile/statistics.rb +7 -7
  19. data/lib/quakelive_api/profile/summary.rb +21 -21
  20. data/lib/quakelive_api/version.rb +1 -1
  21. data/quakelive_api.gemspec +7 -6
  22. data/test/fixtures/awards/career_milestones.yml +262 -0
  23. data/test/fixtures/awards/experience.yml +1019 -0
  24. data/test/fixtures/profiles/emqz.yml +331 -0
  25. data/test/fixtures/profiles/error.yml +53 -0
  26. data/test/fixtures/profiles/full/awards_experience.yml +1019 -0
  27. data/test/fixtures/profiles/full/awards_milestones.yml +262 -0
  28. data/test/fixtures/profiles/full/awards_skillz.yml +592 -0
  29. data/test/fixtures/profiles/full/awards_social.yml +163 -0
  30. data/test/fixtures/profiles/full/awards_success.yml +449 -0
  31. data/test/fixtures/profiles/full/statistics.yml +438 -0
  32. data/test/fixtures/profiles/full/summary.yml +331 -0
  33. data/test/fixtures/profiles/mariano.yml +329 -0
  34. data/test/fixtures/profiles/not_existing.yml +57 -0
  35. data/test/fixtures/statistics/xsi.yml +438 -0
  36. data/test/quakelive_api/profile/awards/career_milestones_test.rb +8 -9
  37. data/test/quakelive_api/profile/awards/experience_test.rb +6 -7
  38. data/test/quakelive_api/profile/statistics_test.rb +31 -37
  39. data/test/quakelive_api/profile/summary_test.rb +60 -51
  40. data/test/quakelive_api/profile_test.rb +37 -32
  41. data/test/test_helper.rb +10 -30
  42. metadata +71 -72
  43. data/test/fixtures/awards/career.txt +0 -382
  44. data/test/fixtures/awards/experience.txt +0 -769
  45. data/test/fixtures/awards/mad_skillz.txt +0 -915
  46. data/test/fixtures/awards/social_life.txt +0 -155
  47. data/test/fixtures/awards/sweet_success.txt +0 -684
  48. data/test/fixtures/profile/error.txt +0 -24
  49. data/test/fixtures/profile/not_found.txt +0 -36
  50. data/test/fixtures/profile/summary.txt +0 -383
  51. data/test/fixtures/statistics/emqz.txt +0 -431
  52. data/test/fixtures/statistics/xsi.txt +0 -558
  53. data/test/fixtures/summary/emqz.txt +0 -304
  54. data/test/fixtures/summary/mariano.txt +0 -380
  55. data/test/quakelive_api/profile/awards/mad_skillz_test.rb +0 -38
  56. data/test/quakelive_api/profile/awards/social_life_test.rb +0 -38
  57. data/test/quakelive_api/profile/awards/sweet_success_test.rb +0 -38
@@ -4,15 +4,18 @@ describe "QuakeliveApi::Profile::Statistics" do
4
4
  make_my_diffs_pretty!()
5
5
 
6
6
  describe "black box test for" do
7
- before { stub_stats_request(profile, fixture_statistics(profile)) }
8
- subject { QuakeliveApi::Profile::Statistics.new(profile) }
7
+ let(:subject) do
8
+ VCR.use_cassette("statistics/#{profile}") do
9
+ QuakeliveApi::Profile::Statistics.new(profile)
10
+ end
11
+ end
9
12
 
10
13
  describe "xsi" do
11
14
  let(:profile) { "xsi" }
12
15
 
13
16
  it "fetches proper stats for weapons" do
14
17
  [
15
- ['Gauntlet', 185, nil, nil, nil, 1],
18
+ ['Gauntlet', 216, nil, nil, nil, 1],
16
19
  ['Machinegun', 1232, 29, 64253, 225055, 9],
17
20
  ['Shotgun', 2091, 27, 25180, 91693, 9],
18
21
  ['Grenade Launcher', 241, 10, 1383, 14163, 3],
@@ -25,51 +28,42 @@ describe "QuakeliveApi::Profile::Statistics" do
25
28
  ['Nailgun', 18, 13, 466, 3495, 0],
26
29
  ['Proximity Mine', 7, 24, 40, 164, 0]
27
30
  ].each_with_index do |weapon, index|
28
- assert_equal subject.weapons[index], QuakeliveApi::Items::Weapon.new(*weapon)
31
+ expected_weapon = QuakeliveApi::Items::Weapon.new(*weapon)
32
+ current_weapon = subject.weapons[index]
33
+
34
+ assert_equal current_weapon.name, expected_weapon.name
35
+ assert_operator current_weapon.frags.to_i, :>=, expected_weapon.frags.to_i
36
+ assert_operator current_weapon.hits.to_i, :>=, expected_weapon.hits.to_i
37
+ assert_operator current_weapon.shots.to_i, :>=, expected_weapon.shots.to_i
38
+ assert_in_delta expected_weapon.accuracy.to_i, current_weapon.accuracy.to_i, 5
39
+ assert_in_delta expected_weapon.usage.to_i, current_weapon.usage.to_i, 5
29
40
  end
30
41
  end
31
42
 
32
43
  it "fetches proper stats for records" do
33
44
  [
34
- ['Clan Arena', 13, 13, 7, 0, 100, 54],
35
- ['Capture The Flag', 74, 67, 39, 7, 91, 53],
36
- ['Free For All', 31, 27, 10, 4, 87, 32],
37
- ['Domination', 16, 16, 11, 0, 100, 69],
38
- ['Freeze Tag', 1, 0, 0, 1, 0, 0],
45
+ ['Clan Arena', 47, 46, 25, 1, 98, 53],
46
+ ['Capture The Flag', 74, 67, 39, 7, 90, 53],
47
+ ['Free For All', 31, 27, 10, 4, 87, 25],
48
+ ['Domination', 16, 16, 11, 0, 99, 59],
49
+ ['Freeze Tag', 77, 73, 55, 4, 95, 71],
50
+ ['Harvester', 3, 3, 2, 0, 100, 67],
39
51
  ['Team Deathmatch', 155, 142, 79, 13, 92, 51],
40
- ['Duel', 532, 503, 210, 29, 95, 39],
52
+ ['Duel', 532, 503, 210, 29, 94, 39],
41
53
  ['Total', 822, 768, 356, 54, 93, 43]
42
54
  ].each_with_index do |record, index|
43
- assert_equal subject.records[index], QuakeliveApi::Items::Record.new(*record)
44
- end
45
- end
46
- end
47
-
48
- describe "emqz" do
49
- let(:profile) { "emqz" }
55
+ expected_record = QuakeliveApi::Items::Record.new(*record)
56
+ current_record = subject.records[index]
50
57
 
51
- it "fetches proper stats for weapons" do
52
- [
53
- ['Gauntlet', 0, nil, nil, nil, 0],
54
- ['Machinegun', 0, 0, 0, 0, 0],
55
- ['Shotgun', 0, 0, 0, 0, 0],
56
- ['Grenade Launcher', 0, 0, 0, 0, 0],
57
- ['Rocket Launcher', 0, 0, 0, 0, 0],
58
- ['Lightning Gun', 0, 0, 0, 0, 0],
59
- ['Railgun', 0, 0, 0, 0, 0],
60
- ['Plasma Gun', 0, 0, 0, 0, 0],
61
- ['BFG', 0, 0, 0, 0, 0],
62
- ['Chaingun', 0, 0, 0, 0, 0],
63
- ['Nailgun', 0, 0, 0, 0, 0],
64
- ['Proximity Mine', 0, 0, 0, 0, 0]
65
- ].each_with_index do |weapon, index|
66
- assert_equal subject.weapons[index], QuakeliveApi::Items::Weapon.new(*weapon)
58
+ assert_equal current_record.title, expected_record.title
59
+ assert_operator current_record.played, :>=, expected_record.played
60
+ assert_operator current_record.finished, :>=, expected_record.finished
61
+ assert_operator current_record.wins, :>=, expected_record.wins
62
+ assert_operator current_record.quits, :>=, expected_record.quits
63
+ assert_operator current_record.completed, :>=, expected_record.completed
64
+ assert_in_delta expected_record.wins_percentage, current_record.wins_percentage, 5
67
65
  end
68
66
  end
69
-
70
- it "fetches proper stats for records" do
71
- assert_equal subject.records, nil
72
- end
73
67
  end
74
68
  end
75
69
  end
@@ -4,35 +4,55 @@ describe "QuakeliveApi::Profile::Summary" do
4
4
  make_my_diffs_pretty!
5
5
 
6
6
  describe "black box test for" do
7
- before { stub_summary_request(profile, fixture_summary(profile)) }
8
- subject { QuakeliveApi::Profile::Summary.new(profile) }
7
+ before do
8
+ VCR.use_cassette("profiles/#{profile}") do
9
+ @summary = QuakeliveApi::Profile::Summary.new(profile)
10
+ end
11
+ end
12
+
13
+ subject { @summary }
9
14
 
10
15
  describe "emqz" do
11
16
  let(:profile) { "emqz" }
12
17
 
13
18
  its(:country) { must_equal "Poland" }
14
19
  its(:nick) { must_equal "emqz"}
15
- its(:clan) { must_equal nil }
20
+ its(:clan) { must_equal "ORG" }
16
21
 
17
22
  its(:model) { must_equal QuakeliveApi::Items::Model.new(
18
- "Major / Default",
19
- "http://cdn.quakelive.com/web/2013071600/images/players/body_md/major_default_v2013071600.0.png") }
23
+ "Anarki / Default",
24
+ "http://cdn.quakelive.com/web/2014080602/images/players/body_md/anarki_default_v2014080602.0.png") }
20
25
 
21
26
  its(:member_since) { must_equal Date.parse('23.06.2013') }
22
- its(:last_game) { must_equal nil }
23
- its(:time_played) { must_equal nil }
24
- its(:wins) { must_equal 0 }
25
- its(:losses) { must_equal 0 }
26
- its(:quits) { must_equal 0 }
27
- its(:frags) { must_equal 0 }
28
- its(:deaths) { must_equal 0 }
29
- its(:hits) { must_equal 0 }
30
- its(:shots) { must_equal 0 }
31
- its(:accuracy) { must_equal 0.0 }
32
- its(:favourite) { must_equal QuakeliveApi::Items::Favourite.new(nil, nil, nil) }
33
- its(:recent_awards) { must_equal nil }
34
- its(:recent_games) { must_equal nil }
35
- its(:recent_competitors) { must_equal nil }
27
+ its(:last_game) { must_be :>, Time.parse('16.12.2013 2:40 PM') }
28
+ its(:time_played) { must_equal QuakeliveApi::GameTime.new("Ranked Time: 1.11:25:38 Unranked Time: 5.01:12:06") }
29
+ its(:wins) { must_be :>, 85 }
30
+ its(:losses) { must_be :>, 135 }
31
+ its(:quits) { must_be :>, 27 }
32
+ its(:frags) { must_be :>, 2987 }
33
+ its(:deaths) { must_be :>, 3660 }
34
+ its(:hits) { must_be :>, 36_076 }
35
+ its(:shots) { must_be :>, 185_443 }
36
+ its(:accuracy) { must_be_within_delta 19, 2 }
37
+ its(:favourite) { must_equal QuakeliveApi::Items::Favourite.new("Chemical Reaction","Capture The Flag","Rocket Launcher") }
38
+ its(:recent_awards) { must_include QuakeliveApi::Items::Award.new(
39
+ 'http://cdn.quakelive.com/web/2014080602/images/awards/md/sucker_punch_v2014080602.0.png',
40
+ 'LOL! Pwn3d!',
41
+ 'Sucker Punch',
42
+ 'Awarded 9 days ago',
43
+ 'Use the Gauntlet to frag an opponent who has Quad Damage.') }
44
+
45
+ its(:recent_games) { must_include QuakeliveApi::Items::RecentGame.new(
46
+ 'CTF',
47
+ 'Win',
48
+ '5 days ago',
49
+ 'http://cdn.quakelive.com/web/2014080602/images/levelshots/lg/japanesecastles_v2014080602.0.jpg')
50
+ }
51
+
52
+ its(:recent_competitors) { must_include QuakeliveApi::Items::Competitor.new(
53
+ 'http://cdn.quakelive.com/web/2014080602/images/players/icon_lg/janet_default_v2014080602.0.png',
54
+ 'Good_trade',
55
+ Time.parse('13.08.2014 2:31 PM'))}
36
56
  end
37
57
 
38
58
  describe "mariano" do
@@ -43,50 +63,39 @@ describe "QuakeliveApi::Profile::Summary" do
43
63
  its(:clan) { must_equal nil }
44
64
 
45
65
  its(:model) { must_equal QuakeliveApi::Items::Model.new(
46
- "Bitterman / Default",
47
- "http://cdn.quakelive.com/web/2013071600/images/players/body_md/bitterman_default_v2013071600.0.png") }
66
+ "Sarge / Default",
67
+ "http://cdn.quakelive.com/web/2014080602/images/players/body_md/sarge_default_v2014080602.0.png") }
48
68
 
49
69
  its(:member_since) { must_equal Date.parse('7.02.2009') }
50
- its(:last_game) { must_equal Time.parse('11-07-2013 2:59 PM') }
51
- its(:time_played) { must_equal QuakeliveApi::GameTime.new("Ranked Time: 52.19:25:52 Unranked Time: 02:31:02") }
52
- its(:wins) { must_equal 4278 }
53
- its(:losses) { must_equal 3015 }
54
- its(:quits) { must_equal 518 }
55
- its(:frags) { must_equal 97_102 }
56
- its(:deaths) { must_equal 88_381 }
57
- its(:hits) { must_equal 1_960_767 }
58
- its(:shots) { must_equal 6_085_608 }
59
- its(:accuracy) { must_equal 32.22 }
60
- its(:favourite) { must_equal QuakeliveApi::Items::Favourite.new("Furious Heights","Duel","Lightning Gun") }
70
+ its(:last_game) { must_be :>, Time.parse('19.12.2013 7:08 PM') }
71
+ its(:time_played) { must_equal QuakeliveApi::GameTime.new("Ranked Time: 78.13:26:07 Unranked Time: 14:45:28") }
72
+ its(:wins) { must_be :>, 5_123 }
73
+ its(:losses) { must_be :>, 3_709 }
74
+ its(:quits) { must_be :>, 601 }
75
+ its(:frags) { must_be :>, 131_866 }
76
+ its(:deaths) { must_be :>, 121_013 }
77
+ its(:hits) { must_be :>, 2_671_126 }
78
+ its(:shots) { must_be :>, 8_355_653 }
79
+ its(:accuracy) { must_be_within_delta 31, 2 }
80
+ its(:favourite) { must_equal QuakeliveApi::Items::Favourite.new("Toxicity","Duel","Lightning Gun") }
61
81
  its(:recent_awards) { must_include QuakeliveApi::Items::Award.new(
62
- 'http://cdn.quakelive.com/web/2013071600/images/awards/md/team_killer_v2013071600.0.png',
63
- 'Hope you touched the flag first!',
64
- 'Team Killer',
65
- 'Awarded 2 months ago',
66
- 'Kill all players on the opposing team in a single round in Attack & Defend, minimum size 3.') }
67
-
68
- its(:recent_awards) { must_include QuakeliveApi::Items::Award.new(
69
- 'http://cdn.quakelive.com/web/2013071600/images/awards/md/pql_1_v2013071600.0.png',
70
- 'Do you think thats air youre breathing now?',
71
- 'Too Fast',
72
- 'Awarded 2 months ago',
73
- 'Complete 1 online PQL match.') }
82
+ 'http://cdn.quakelive.com/web/2014080602/images/awards/md/winternights2013_v2014080602.0.png',
83
+ '',
84
+ 'Winter Nights 2013',
85
+ 'Awarded 8 months ago',
86
+ 'Complete a match on "Silent Night" or "Winter\'s Edge" during the 2013 holidays.') }
74
87
 
75
88
  its(:recent_games) { must_be_instance_of Array }
76
89
  its(:recent_games) { wont_include nil }
77
90
  its(:recent_games) { must_include QuakeliveApi::Items::RecentGame.new(
78
- 'TDM',
91
+ 'Duel',
79
92
  'Loss',
80
- '20 days ago',
81
- 'http://cdn.quakelive.com/web/2013071600/images/levelshots/lg/hiddenfortress_v2013071600.0.jpg')
93
+ '3 days ago',
94
+ 'http://cdn.quakelive.com/web/2014080602/images/levelshots/lg/toxicity_v2014080602.0.jpg')
82
95
  }
83
96
 
84
97
  its(:recent_competitors) { wont_include nil }
85
98
  its(:recent_competitors) { must_be_instance_of Array }
86
- its(:recent_competitors) { must_include QuakeliveApi::Items::Competitor.new(
87
- 'http://cdn.quakelive.com/web/2013071600/images/players/icon_lg/bitterman_red_v2013071600.0.png',
88
- 'Jeezy',
89
- Time.parse('2013-07-11 14:59:00'))}
90
99
  end
91
100
  end
92
101
  end
@@ -1,67 +1,72 @@
1
+ # coding: utf-8
1
2
  require "test_helper"
2
3
 
3
4
  describe "QuakeliveApi::Profile" do
4
5
 
5
6
  describe "on error" do
6
7
  it "raises an exception on non existing profiles" do
7
- stub_summary_request "not-here", fixture_profile("not_found")
8
- profile = QuakeliveApi::Profile.new('not-here')
9
- assert_raises(QuakeliveApi::Error::PlayerNotFound) { profile.summary }
8
+ VCR.use_cassette("profiles/not_existing") do
9
+ profile = QuakeliveApi::Profile.new('not_existing_profile123')
10
+ assert_raises(QuakeliveApi::Error::PlayerNotFound) { profile.summary }
11
+ end
10
12
  end
11
13
 
12
14
  it "raises an exception on request error response from ql" do
13
- stub_summary_request "error-profile", fixture_profile("error")
14
- profile = QuakeliveApi::Profile.new('error-profile')
15
- assert_raises(QuakeliveApi::Error::RequestError) { profile.summary }
15
+ VCR.use_cassette("profiles/error") do
16
+ profile = QuakeliveApi::Profile.new('óąśðł')
17
+ assert_raises(QuakeliveApi::Error::RequestError) { profile.summary }
18
+ end
16
19
  end
17
20
  end
18
21
 
19
22
  describe "on success" do
20
23
  it "returns an instance of summary class on 'summary' call" do
21
- stub_summary_request "all-good", fixture_summary("emqz")
22
- profile = QuakeliveApi::Profile.new('all-good')
23
- assert_instance_of QuakeliveApi::Profile::Summary, profile.summary
24
+ VCR.use_cassette("profiles/full/summary") do
25
+ profile = QuakeliveApi::Profile.new('emqz')
26
+ assert_instance_of QuakeliveApi::Profile::Summary, profile.summary
27
+ end
24
28
  end
25
29
 
26
30
  it "returns an instance of statistics class on 'statistics' call" do
27
- stub_stats_request "stats-test", fixture_statistics("xsi")
28
- profile = QuakeliveApi::Profile.new('stats-test')
29
- assert_instance_of QuakeliveApi::Profile::Statistics, profile.statistics
31
+ VCR.use_cassette("profiles/full/statistics") do
32
+ profile = QuakeliveApi::Profile.new('xsi')
33
+ assert_instance_of QuakeliveApi::Profile::Statistics, profile.statistics
34
+ end
30
35
  end
31
36
 
32
37
  it "returns an instance of career milestones class on 'awards_milestones' call" do
33
- profile = QuakeliveApi::Profile.new('awards-test')
34
- stub_request(:get, "http://www.quakelive.com/profile/awards/awards-test/3")
35
- assert_instance_of QuakeliveApi::Profile::Awards::CareerMilestones, profile.awards_milestones
38
+ VCR.use_cassette("profiles/full/awards_milestones") do
39
+ profile = QuakeliveApi::Profile.new('emqz')
40
+ assert_instance_of QuakeliveApi::Profile::Awards::CareerMilestones, profile.awards_milestones
41
+ end
36
42
  end
37
43
 
38
44
  it "returns an instance of experience class on 'awards_experience' call" do
39
- profile = QuakeliveApi::Profile.new('awards-test')
40
- stub_request(:get, "http://www.quakelive.com/profile/awards/awards-test/1")
41
- assert_instance_of QuakeliveApi::Profile::Awards::Experience, profile.awards_experience
45
+ VCR.use_cassette("profiles/full/awards_experience") do
46
+ profile = QuakeliveApi::Profile.new('emqz')
47
+ assert_instance_of QuakeliveApi::Profile::Awards::Experience, profile.awards_experience
48
+ end
42
49
  end
43
50
 
44
51
  it "returns an instance of mad skillz class on 'awards_skillz' call" do
45
- profile = QuakeliveApi::Profile.new('awards-test')
46
- stub_request(:get, "http://www.quakelive.com/profile/awards/awards-test/2")
47
- assert_instance_of QuakeliveApi::Profile::Awards::MadSkillz, profile.awards_skillz
52
+ VCR.use_cassette("profiles/full/awards_skillz") do
53
+ profile = QuakeliveApi::Profile.new('awards-test')
54
+ assert_instance_of QuakeliveApi::Profile::Awards::MadSkillz, profile.awards_skillz
55
+ end
48
56
  end
49
57
 
50
58
  it "returns an instance of social life class on 'awards_social' call" do
51
- profile = QuakeliveApi::Profile.new('awards-test')
52
- stub_request(:get, "http://www.quakelive.com/profile/awards/awards-test/5")
53
- assert_instance_of QuakeliveApi::Profile::Awards::SocialLife, profile.awards_social
59
+ VCR.use_cassette("profiles/full/awards_social") do
60
+ profile = QuakeliveApi::Profile.new('xsi')
61
+ assert_instance_of QuakeliveApi::Profile::Awards::SocialLife, profile.awards_social
62
+ end
54
63
  end
55
64
 
56
65
  it "returns an instance of sweet success class on 'awards_success' call" do
57
- profile = QuakeliveApi::Profile.new('awards-test')
58
- stub_request(:get, "http://www.quakelive.com/profile/awards/awards-test/4")
59
- assert_instance_of QuakeliveApi::Profile::Awards::SweetSuccess, profile.awards_success
60
- end
61
-
62
- it "responds to each_award" do
63
- profile = QuakeliveApi::Profile.new('awards-test')
64
- assert_respond_to(profile, :each_award)
66
+ VCR.use_cassette("profiles/full/awards_success") do
67
+ profile = QuakeliveApi::Profile.new('emqz')
68
+ assert_instance_of QuakeliveApi::Profile::Awards::SweetSuccess, profile.awards_success
69
+ end
65
70
  end
66
71
  end
67
72
  end
data/test/test_helper.rb CHANGED
@@ -1,36 +1,16 @@
1
- require 'simplecov'
2
- SimpleCov.start
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
3
4
  require "minitest/autorun"
4
5
  require "webmock/minitest"
6
+ require "vcr"
7
+ require "quakelive_api"
5
8
 
6
- require "#{File.dirname(__FILE__)}/../lib/quakelive_api"
7
-
8
- def fixtures_path
9
- "#{File.dirname(__FILE__)}/fixtures"
10
- end
11
-
12
- def fixture_profile(name)
13
- File.read "#{fixtures_path}/profile/#{name}.txt"
14
- end
15
-
16
- def fixture_summary(name)
17
- File.read "#{fixtures_path}/summary/#{name}.txt"
18
- end
19
-
20
- def fixture_statistics(name)
21
- File.read "#{fixtures_path}/statistics/#{name}.txt"
22
- end
23
-
24
- def fixture_awards(name)
25
- File.read "#{fixtures_path}/awards/#{name}.txt"
26
- end
27
-
28
- def stub_summary_request(profile_name, content)
29
- stub_request(:get, "#{QuakeliveApi.site}/profile/summary/#{profile_name}").to_return(content)
30
- end
9
+ WebMock.disable_net_connect! allow: %w{coveralls.io}
31
10
 
32
- def stub_stats_request(profile_name, content)
33
- stub_request(:get, "#{QuakeliveApi.site}/profile/statistics/#{profile_name}").to_return(content)
11
+ VCR.configure do |c|
12
+ c.cassette_library_dir = 'test/fixtures'
13
+ c.hook_into :webmock
34
14
  end
35
15
 
36
16
  # taken from its-minitest gem, as I'm used to rspec syntax (and it's quite convenient for blackbox testing)
@@ -40,7 +20,7 @@ class MiniTest::Spec
40
20
  let(:inner_subject) { subject.send(attribute) }
41
21
 
42
22
  it "verify subject.#{attribute} for" do
43
- inner_subject.instance_eval &block
23
+ inner_subject.instance_eval(&block)
44
24
  end
45
25
  end
46
26
  end