Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit b505cd31110d383aa7d256fd6c1bc7698891b1ba 1 parent 9cb7733
@thegreatape authored
Showing with 14 additions and 11 deletions.
  1. +2 −2 config/environments/test.rb
  2. +12 −9 config/initializers/sidekiq.rb
View
4 config/environments/test.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
View
21 config/initializers/sidekiq.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.