Permalink
Browse files

Ensure that config changes are honored.

  • Loading branch information...
1 parent 2a53e65 commit 0a4e26b4671feb6ad2adb67ce4af72931d047dfc Jamie Kite committed Oct 19, 2011
Showing with 22 additions and 2 deletions.
  1. +1 −1 lib/chargify_api_ares.rb
  2. +21 −1 spec/base_spec.rb
View
@@ -61,7 +61,7 @@ def configure
Base.password = 'X'
Base.timeout = timeout unless (timeout.blank?)
- self.site ||= "https://#{subdomain}.chargify.com"
+ self.site = "https://#{subdomain}.chargify.com"
Base.site = site
Subscription::Component.site = site + "/subscriptions/:subscription_id"
View
@@ -6,5 +6,25 @@
Chargify::Base.stub!(:name).and_return("Test::Namespace::ElementName")
Chargify::Base.element_name.should eql('element_name')
end
-
+
+ context 'configuration changes' do
+ before do
+ @original_subdomain = Chargify.subdomain
+ end
+
+ it "honors changes made after the first configuration" do
+ expect do
+ Chargify.configure do |c|
+ c.subdomain = "something-new"
+ end
+ end.to change { Chargify::Base.site.to_s }.to("https://something-new.chargify.com")
+ end
+
+ after do
+ Chargify.configure do |c|
+ c.subdomain = @original_subdomain
+ end
+ end
+ end
+
end

0 comments on commit 0a4e26b

Please sign in to comment.