Skip to content

Commit

Permalink
tests for default region.
Browse files Browse the repository at this point in the history
(US, because i am geopoliticall biased that way.)
  • Loading branch information
defeated committed Jul 22, 2011
1 parent cc5e3a9 commit 9e9a986
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/wow_community_api/battle_net.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module WowCommunityApi
class BattleNet
include HTTParty

# TODO: make this configurable?
DEFAULT_REGION = Regions::US

def self.region(name)
self.base_uri "#{name}.battle.net/api/wow"
end
base_uri region(Regions::US)
base_uri region(DEFAULT_REGION)

def self.get(path, options = {})
super(URI.encode(path), options).to_ostruct
Expand Down
4 changes: 4 additions & 0 deletions spec/battle_net_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
BattleNet.region(Regions::KR).should == "http://kr.battle.net/api/wow"
BattleNet.region(Regions::TW).should == "http://tw.battle.net/api/wow"
end

it "defaults to US region" do
BattleNet::DEFAULT_REGION.should == Regions::US
end
end
end

0 comments on commit 9e9a986

Please sign in to comment.