I'm starting to see the following output when running request rspec specs:
cache: [GET /login] miss
cache: [GET /javascripts/jquery.min.js?1317513028] miss
Normaly I would get green dots for passing tests and red Fs with some info for error messages.
Is there a way to disable the cache miss messages from the output?
I think this has nothing to do with rspec and that rspec is just printing out what is in the rails log. I think this post by Brian Weaver on the Phusion Passenger discussion group might answer your question:
Do you have rack-cache installed? I spent a good day+ tracing through Passenger/Rails/Rack and lots of other gems to find out why lines similar to that one was appearing. Add the following to your production.rb or development.rb file to get rid of the 'cache: ....' line
config.action_dispatch.rack_cache = {:metastore => "rails:/", :entitystore => "rails:/", :verbose => false}
I pulled that line from within the "middleware" configuration of Rails an just changed the 'verbose' from true to false.
In your case, I guess you want to add it your your test environment file.
In addition to @RyanTM you also need to turn caching on for the test environment so that DragonFly does not configure its own Rack::Cache (with :verbose => true) but instead uses the one setup by Rails.
# set Rack::Cache verbose to false to prevent logging to rspec output
config.action_controller.perform_caching = true
config.action_dispatch.rack_cache = {:metastore => "rails:/", :entitystore => "rails:/", :verbose => false}
I couldn't get either of the above workarounds to work for me, but adding this to my 'config/initializers/dragonfly.rb' worked:
if Rails.env.test?
Rails.application.middleware.delete Rack::Cache
Rails.application.middleware.insert 0, Rack::Cache, {
:verbose => false,
:metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces
:entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
}
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With