I have a CSS file that I want to run only in test mode, and not in development or production. I know how to do this inline as follows:
<% if Rails.env.test? &>
<style>
//My test only styles
</style>
<% end %>
This works, however, I prefer to avoid inline stylesheets since they're unorganized and hard to maintain. I've tried applying it to an external stylesheet as such:
<%= stylesheet_link_tag 'my_stylesheet.css' if Rails.env.test? %>
But this only works if I add my CSS file to applications.css. And If I do this, the file gets added regardless of which environment I'm running in.
So my question is, how I can add an external stylesheet in rails that is only run while in test mode? For bonus points, how could I get rails to compile SASS that only runs in test mode?