Skip to content

Commit

Permalink
[api] make use memcached in test environment
Browse files Browse the repository at this point in the history
but make sure not to reuse old caches
  • Loading branch information
coolo committed Oct 18, 2013
1 parent 23d1512 commit 5ffc4a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/api/config/environments/test.rb
@@ -1,5 +1,7 @@
# Settings specified here will take precedence over those in config/environment.rb

ENV['CACHENAMESPACE'] ||= "obs-api-test-#{Time.now.to_i}"

OBSApi::Application.configure do

# The test environment is used exclusively to run your application's
Expand All @@ -18,7 +20,7 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

config.cache_store = :null_store
config.cache_store = :dalli_store, '127.0.0.1:11211', {namespace: ENV['CACHENAMESPACE'], expires_in: 1.hour }

config.active_support.deprecation = :log

Expand Down
6 changes: 1 addition & 5 deletions src/api/config/initializers/session_store.rb
@@ -1,6 +1,2 @@
# cookies are too small and active record sessions cause too much load
if Rails.env.test?
Rails.application.config.session_store ActionDispatch::Session::CookieStore
else
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 1.day
end
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 1.day

0 comments on commit 5ffc4a1

Please sign in to comment.