To test a Rails engine, you use a dummy application within the test/spec directory. Various piping is done to link it to your engine, and to merge things like Rakefiles. When trying to test with Jasmine, I was finding that some "piping" was missing, which meant that specs were being looked for in:
The final solution came from this blog post, but as it's slightly out of date, I thought I'd provide a new write up.
This solution uses jasminerice. This ceased to be developed a while ago, but they've recently found a new maintainer, so I'm less concerned that I was before about using the project. You also need to use the Github version of jasminerice at the moment. You can do this by adding it to your Gemfile (probably as well as your gemspec):
# Gemspec s.add_development_dependency "jasminerice" # Gemfile gem 'jasminerice', github: 'bradphelan/jasminerice'
The key thing to fix the path issue is then to add the following:
/* *= require application */
#= require jquery #= require jquery_ujs #= require_tree . jasmine.getFixtures().fixturesPath = 'fixtures'
#= require my_engine/my_model describe "Something", -> it "exists", -> expect(1).toEqual(1) expect(MyEngine.MyModel).not.toBeUndefined()
Thanks again to Daniel Wanja for getting me to that solution. He deserves the credit.