Move caching initialization to Railtie

Also
- Add reference to config from ActiveModelSerializers.config
- correctly call super in FragmentCacheTest#setup
- rename test rails app from Foo to ActiveModelSerializers::RailsApplication
This commit is contained in:
Benjamin Fleischer
2015-11-10 01:39:30 -06:00
parent 2bea7f94f3
commit a9ce4fb766
5 changed files with 20 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ module ActiveModel
module Adapter
class FragmentCacheTest < Minitest::Test
def setup
super
@spam = Spam::UnrelatedLink.new(id: 'spam-id-1')
@author = Author.new(name: 'Joao M. D. Moura')
@role = Role.new(name: 'Great Author', description: nil)

View File

@@ -1,14 +1,18 @@
class Foo < Rails::Application
class ActiveModelSerializers::RailsApplication < Rails::Application
if Rails::VERSION::MAJOR >= 4
config.eager_load = false
config.secret_key_base = 'abc123'
config.action_controller.perform_caching = true
config.active_support.test_order = :random
config.logger = Logger.new(nil)
config.action_controller.perform_caching = true
ActionController::Base.cache_store = :memory_store
end
end
Foo.initialize!
ActiveModelSerializers::RailsApplication.initialize!
module TestHelper
Routes = ActionDispatch::Routing::RouteSet.new