Permalink
Browse files

Don't re-define goodreads API constants in test

env and don't load sidekiq autoscaling if not
in production.
  • Loading branch information...
thegreatape committed Nov 6, 2012
1 parent 7be51ca commit 620172a9eb75fb1bad796e54d92d66d2a8b2b655
Showing with 14 additions and 11 deletions.
  1. +2 −2 config/environments/test.rb
  2. +12 −9 config/initializers/sidekiq.rb
@@ -41,8 +41,8 @@
FakeWeb.allow_net_connect = false
# stub goodreads constants
- GOODREADS_API_KEY = ' '
- GOODREADS_API_SECRET = ' '
+ ENV['GOODREADS_API_KEY'] = ' '
+ ENV['GOODREADS_API_SECRET'] = ' '
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
@@ -1,14 +1,17 @@
-require 'autoscaler/sidekiq'
-require 'autoscaler/heroku_scaler'
+if Rails.env == 'production'
+ require 'autoscaler/sidekiq'
+ require 'autoscaler/heroku_scaler'
-Sidekiq.configure_client do |config|
- config.client_middleware do |chain|
- chain.add Autoscaler::Sidekiq::Client, 'default' => Autoscaler::HerokuScaler.new
+ Sidekiq.configure_client do |config|
+ config.client_middleware do |chain|
+ chain.add Autoscaler::Sidekiq::Client, 'default' => Autoscaler::HerokuScaler.new
+ end
end
-end
-Sidekiq.configure_server do |config|
- config.server_middleware do |chain|
- chain.add(Autoscaler::Sidekiq::Server, Autoscaler::HerokuScaler.new, 60)
+ Sidekiq.configure_server do |config|
+ config.server_middleware do |chain|
+ chain.add(Autoscaler::Sidekiq::Server, Autoscaler::HerokuScaler.new, 60)
+ end
end
+
end

0 comments on commit 620172a

Please sign in to comment.