Permalink
Browse files

fix default_data_center logic

  • Loading branch information...
1 parent 0e8f93e commit 1096cee7110b3fd54e8616488355880504d0e649 Dan Pickett committed Mar 11, 2012
Showing with 36 additions and 1 deletion.
  1. +1 −1 lib/monkey_party.rb
  2. +35 −0 spec/monkey_party_spec.rb
View
@@ -17,7 +17,7 @@ def self.data_center
@data_center || default_data_center
end
- def self.data_center
+ def self.default_data_center
"us1"
end
end
View
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe MonkeyParty do
+ let(:new_api_key) { "an api key" }
+ let(:new_data_center) { "us3" }
+ it "allows for the setting of an api key" do
+ old_key = MonkeyParty.api_key.dup
+
+ MonkeyParty.api_key = new_api_key
+ MonkeyParty.api_key.should eql(new_api_key)
+
+ #revert api key
+ MonkeyParty.api_key = old_key
+ end
+
+ it "allows for the setting of a datacenter" do
+ old_center = MonkeyParty.data_center.dup
+
+ MonkeyParty.data_center = new_data_center
+ MonkeyParty.data_center.should eql(new_data_center)
+
+ #revert data center
+ MonkeyParty.data_center = old_center
+ end
+
+ it "defaults the data center to us1" do
+ old_center = MonkeyParty.data_center.dup
+
+ MonkeyParty.data_center = nil
+ MonkeyParty.data_center.should eql("us1")
+
+ #revert data center
+ MonkeyParty.data_center = old_center
+ end
+end

0 comments on commit 1096cee

Please sign in to comment.