Permalink
Browse files

Honor the chargify site over the subdomain

- Add specific gem versions to the test group
  • Loading branch information...
1 parent b8cf774 commit 1dc6c13635eccddabfb98015c4c49e937de5ea0e @shayfrendt shayfrendt committed Oct 19, 2011
Showing with 35 additions and 23 deletions.
  1. +6 −6 Gemfile
  2. +9 −8 Gemfile.lock
  3. +7 −3 lib/chargify_api_ares.rb
  4. +11 −1 spec/base_spec.rb
  5. +2 −5 spec/remote/spec_helper.rb
View
12 Gemfile
@@ -3,12 +3,12 @@ source :rubygems
gem 'activeresource', '>= 2.3.4'
group :test do
- gem 'rake'
- gem 'rspec'
- gem 'fuubar'
- gem 'factory_girl'
- gem 'fakeweb'
- gem 'faker'
+ gem 'rake', '~> 0.9.2'
+ gem 'rspec', '~> 2.6.0'
+ gem 'fuubar', '~> 0.0.6'
+ gem 'factory_girl', '~> 2.2.0'
+ gem 'fakeweb', '~> 1.3.0'
+ gem 'faker', '~> 1.0.1'
gem 'guard-rspec', '~> 0.5.0', :require => false
gem 'growl', '~> 1.0.3', :require => false
gem 'rb-fsevent', '~> 0.4.2', :require => false
View
@@ -14,8 +14,9 @@ GEM
bcrypt-ruby (2.1.4)
builder (3.0.0)
diff-lcs (1.1.2)
- factory_girl (2.0.4)
- faker (0.9.5)
+ factory_girl (2.2.0)
+ activesupport
+ faker (1.0.1)
i18n (~> 0.4)
fakeweb (1.3.0)
fuubar (0.0.6)
@@ -48,12 +49,12 @@ PLATFORMS
DEPENDENCIES
activeresource (>= 2.3.4)
- factory_girl
- faker
- fakeweb
- fuubar
+ factory_girl (~> 2.2.0)
+ faker (~> 1.0.1)
+ fakeweb (~> 1.3.0)
+ fuubar (~> 0.0.6)
growl (~> 1.0.3)
guard-rspec (~> 0.5.0)
- rake
+ rake (~> 0.9.2)
rb-fsevent (~> 0.4.2)
- rspec
+ rspec (~> 2.6.0)
View
@@ -60,9 +60,13 @@ def configure
Base.user = api_key
Base.password = 'X'
Base.timeout = timeout unless (timeout.blank?)
-
- self.site = "https://#{subdomain}.chargify.com"
-
+
+ if site.to_s != Base.site.to_s
+ self.site = site || "https://#{subdomain}.chargify.com"
+ else
+ self.site = "https://#{subdomain}.chargify.com"
+ end
+
Base.site = site
Subscription::Component.site = site + "/subscriptions/:subscription_id"
Subscription::Statement.site = site + "/subscriptions/:subscription_id"
View
@@ -19,6 +19,16 @@
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
+ Chargify.configure do |c|
+ c.subdomain = "crazy-train"
+ c.site = "http://test-site.chargify-test.com"
+ c.api_key = "abc123"
+ end
+ end.to change { Chargify::Base.site.to_s }.to("http://test-site.chargify-test.com")
+ end
after do
Chargify.configure do |c|
@@ -27,4 +37,4 @@
end
end
-end
+end
@@ -8,11 +8,8 @@
RSpec.configure do |config|
config.before(:all) do
Chargify.configure do |c|
- c.subdomain = remote_configuration['subdomain']
c.api_key = remote_configuration['api_key']
- if remote_configuration['site']
- c.site = remote_configuration['site']
- end
+ c.site = remote_configuration['site']
end
end
end
@@ -34,4 +31,4 @@ def load_remote_configuration_file
else
{}
end
-end
+end

0 comments on commit 1dc6c13

Please sign in to comment.