0

I don't think I'm understanding how the Rails asset pipeline works. I'm building a rails engine that has a dependency on bootstrap-sass in its gemspec:

#--------#
# Assets #
#--------#

## https://github.com/twbs/bootstrap-sass
s.add_development_dependency 'bootstrap-sass', '~> 3.1.1.1'

## https://github.com/rails/coffee-rails
s.add_development_dependency 'coffee-rails', '~> 4.0.1'

## https://github.com/Compass/compass-rails
s.add_development_dependency 'compass-rails', '~> 1.1.7'

## https://github.com/rails/sass-rails
s.add_development_dependency 'sass-rails', '~> 4.0.3'

## https://github.com/rails/coffee-rails
s.add_development_dependency 'uglifier', '>= 1.3.0'

In my application.css, file I've got.

/*
 *= require bootstrap
 *= require_tree .
 */

When I run rails s, bootstrap is loaded up inside application.css, but when I run my specs, I get:

 ActionView::Template::Error:
   couldn't find file 'bootstrap'
     (in /Users/typeoneerror/new_app/engines/app_core/app/assets/stylesheets/app_core/application.css:2)

Why does this work when running as development but it cannot find the asset when running test?

typeoneerror
  • 55,990
  • 32
  • 132
  • 223

1 Answers1

-1

2 things I can think of:

Either you are missing the engine declaration, by creating a app_core/lib/app_core/engine.rb file with the following content

module AppCore # Adapt to your real environment
  class Engine < ::Rails::Engine
  end
end

Either you need to remove the add_development_dependency calls and add them gems in your Gemfile

Benjamin Bouchet
  • 12,971
  • 2
  • 41
  • 73
  • I'm having the same problem, albeit with 'import bootstrap' in my main .js file. But this answer is unparseable for me. – Steve Upstill Jul 11 '14 at 20:36