RSpec AssetNotPrecompiledError
Sep 25, 2013
1 minute read

I was writing a spec for a method that used a built-in Rails helper method, image_path. Now my method worked on my development environment, but did not work when my tests ran, and instead threw a:

Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError: path/to/asset.png isn't precompiled

Solution

It took me more than a few minutes to remember that I needed to change a setting in the test.rb envoronment file.

# change
config.assets.compile = false
# to
config.assets.compile = true

Hope this helps someone else out.