Skip to content

Commit

Permalink
Refactor specs to use rspec 3 and vcr.
Browse files Browse the repository at this point in the history
  • Loading branch information
parix committed Feb 26, 2015
1 parent 2df0db6 commit 87e73cc
Show file tree
Hide file tree
Showing 58 changed files with 7,950 additions and 737 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Gemfile.lock
vendor
*.gem
.DS_Store
coverage
15 changes: 10 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
source "https://rubygems.org"

gem "rake", "10.1.1"
gem "rspec", "2.14.1"
gem "webmock", "1.15.2"
gem "vcr", "2.8.0"
gem "coveralls", "0.7.0", require: false
group :development do
gem "rake", "10.1.1"
end

group :test do
gem "rspec", "3.2.0"
gem "webmock", "1.15.2"
gem "vcr", "2.9.3"
gem "coveralls", "0.7.0", require: false
end
1 change: 1 addition & 0 deletions lib/gw2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require "gw2/guild"
require "gw2/misc"
require "gw2/map"
require "gw2/disabled"

module GW2
BASE_URL = "https://api.guildwars2.com/v1"
Expand Down
4 changes: 4 additions & 0 deletions lib/gw2/disabled.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module GW2
class Disabled < StandardError
end
end
4 changes: 2 additions & 2 deletions lib/gw2/event/events.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module GW2
module Event
def self.all
self.where
raise GW2::Disabled, "This endpoint is disabled due to the implementation of Megaserver technology."
end

def self.where(query_hash = {})
parse(request("/events.json", query: query_hash).body)
raise GW2::Disabled, "This endpoint is disabled due to the implementation of Megaserver technology."
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/item/items.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module Item
def self.all
parse(request("/items.json").body)
parse(request("/items.json").body)["items"]
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/map/continents.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module Map
def self.continents
parse(request("/continents.json").body)
parse(request("/continents.json").body)["continents"]
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/map/maps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def self.all
end

def self.where(query_hash = {})
parse(request("/maps.json", query: query_hash).body)
parse(request("/maps.json", query: query_hash).body)["maps"]
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/misc/build.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module Misc
def self.build
parse(request("/build.json").body)
parse(request("/build.json").body)["build_id"]
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gw2/misc/colors.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module Misc
def self.colors
parse(request("/colors.json").body)
parse(request("/colors.json").body)["colors"]
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/recipe/recipes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module Recipe
def self.all
parse(request("/recipes.json").body)
parse(request("/recipes.json").body)["recipes"]
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/wvw/match_details.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module WvW
def self.match_details(match_id)
parse(request("/wvw/match_details.json", query: { match_id: match_id }).body)
parse(request("/wvw/match_details.json", query: { match_id: match_id }).body)["maps"]
end
end
end
2 changes: 1 addition & 1 deletion lib/gw2/wvw/matches.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GW2
module WvW
def self.matches
parse(request("/wvw/matches.json").body)
parse(request("/wvw/matches.json").body)["wvw_matches"]
end
end
end
22 changes: 0 additions & 22 deletions spec/event/event_names_spec.rb

This file was deleted.

55 changes: 0 additions & 55 deletions spec/event/events_spec.rb

This file was deleted.

22 changes: 0 additions & 22 deletions spec/event/map_names_spec.rb

This file was deleted.

22 changes: 0 additions & 22 deletions spec/event/world_names_spec.rb

This file was deleted.

Loading

0 comments on commit 87e73cc

Please sign in to comment.