3

Using rails 3.2.11, and running the acceptance spec:

bundle exec rspec ./spec/acceptance/sparkmaps_spec.rb:429

While it runs, the stdout shows long list of asset like:

cache: [GET /users/sign_up] miss
cache: [GET /assets/head.js] miss, store
cache: [GET /assets/application.css] miss, store
cache: [GET /assets/application.js] miss, store
cache: [GET /assets/bt-signin-from-signup.png] miss, store
cache: [GET /assets/sparkon-logo.png] miss, store
cache: [GET /assets/MyriadPro-Regular.otf] miss, store
cache: [POST /users] invalidate, pass
cache: [GET /home] miss
cache: [GET /sparkmaps/new?solo=true&type=student] miss
cache: [GET /assets/sparkmap_images/overview_picture_frame.png] miss, store
cache: [GET /assets/sparkmap_images/checkbox_off.jpg] miss, store
cache: [GET /assets/down_arrow.png] miss, store
cache: [GET /media/W1siZiIsIjEtM2NkZTJmMTItOGU4NC00MjE0LWE4YzktNDU2ZTRlMzZkMTdiLTE1MHgxNTAucG5nIl0sWyJwIiwidGh1bWIiLCIzNHgzNCJdXQ?sha=16599154] miss, store

which is too painful while tracing.

How to switch it off?

millisami
  • 9,931
  • 15
  • 70
  • 112
  • Take a look at the [quiet_assets](https://github.com/evrone/quiet_assets) gem, although I'm not sure if it will suppress these particular messages. – Thilo Jul 18 '13 at 11:57
  • Well I treid with it in the test env as well, but still the same. – millisami Jul 19 '13 at 12:21

2 Answers2

2

You can disable cache log into your terminal with this into environment.rb file :

config.cache_store.silence!

or you can use :

Try calling #silence! on Rails.cache

How to call silence! on dalli cache_store?

hope it helps !

Community
  • 1
  • 1
rbinsztock
  • 3,025
  • 2
  • 21
  • 34
  • I tried with all these, but still the same cache log appears in the console, both on dev and test env!! – millisami Jul 28 '13 at 10:18
1

Did you try this rails/issues/2639 comment from@macournoyer

Here is the code from the link:

Put it in config/enviroment/test.rb

# Usage: in development.rb
#
#   config.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger
#
class DisableAssetsLogger
  def initialize(app)
    @app = app
    Rails.application.assets.logger = Logger.new('/dev/null')
  end

  def call(env)
    previous_level = Rails.logger.level
    Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
    @app.call(env)
  ensure
    Rails.logger.level = previous_level
  end
 end

I found a post about cucumber and rack_cache which is rack_cache and cucumber

the snippet he mentioned:

require 'rack/cache'
config.middleware.delete ::Rack::Cache
rack_cache_already_inserted = Rails.application.config.action_controller.perform_caching && Rails.application.config.action_dispatch.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")
} unless rack_cache_already_inserted
Flo
  • 540
  • 6
  • 20
  • Well I've tried with that replacing the /assets/ with /cache/ coz my problem is to eliminate the /cache:/ lines in test log. But it didn't work for me. Here is the gist I've put up. https://gist.github.com/6061824 – millisami Jul 23 '13 at 12:00
  • Sorry I didn't test and hopend when you change assets to cache it might work. – Flo Jul 23 '13 at 12:19
  • do you have rack-cache installed? – Flo Jul 23 '13 at 12:36
  • try this in your development.rb or test.rb file: config.action_dispatch.rack_cache = {:metastore => "rails:/", :entitystore => "rails:/", :verbose => false} – Flo Jul 29 '13 at 05:17
  • Well Flo, I tried this too but still the issue remaing. Here is the gist https://gist.github.com/millisami/6111362 of both the test.rb and the stdout of running test. – millisami Jul 30 '13 at 08:55