Skip to content

Commit

Permalink
Reverting the changes made by #25
Browse files Browse the repository at this point in the history
- ActiveResource does not play nice
  • Loading branch information
shayfrendt committed Oct 20, 2011
1 parent f88db58 commit 2dd0bc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
6 changes: 1 addition & 5 deletions lib/chargify_api_ares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ def configure
Base.password = 'X'
Base.timeout = timeout unless (timeout.blank?)

if site.to_s != Base.site.to_s
self.site = site || "https://#{subdomain}.chargify.com"
else
self.site = "https://#{subdomain}.chargify.com"
end
self.site ||= "https://#{subdomain}.chargify.com"

Base.site = site
Subscription::Component.site = site + "/subscriptions/:subscription_id"
Expand Down
33 changes: 10 additions & 23 deletions spec/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,16 @@
@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

it "honors changes made to the subdomain" do
Chargify.configure do |c|
c.subdomain = "grizzly-bear"
c.api_key = "abc123"
end

Chargify.site.should == "https://grizzly-bear.chargify.com"

Chargify.configure do |c|
c.subdomain = "zebra"
c.api_key = "abc123"
end

Chargify.site.should == "https://zebra.chargify.com"
end
# TODO: Because ActiveResource overloads the word "site"
# It is difficult to support setting either the site or subdomain
# after the class has already been configured and loaded
# 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

it "honors the site over the subdomain if it is specified" do
expect do
Expand Down

0 comments on commit 2dd0bc2

Please sign in to comment.