Search code examples
capybara-webkitrspec3ruby-on-rails-4.2

Disable css in test environment for Rspec


I'm using rails 4 and rspec with capybara for testing. I want to disable css in my test environment. How can I do that? Can anyone help me.


Solution

  • The simplest way - skip CSS files loading in your /app/views/layouts/application.html.erb for test env.:

    <% unless Rails.env.test? %>
      <%= stylesheet_link_tag    "application", :media => "all" %>
    <% end %>