Test a Rails engine with Jasmine

522 views
Skip to first unread message

Les Nightingill

unread,
Jun 18, 2012, 10:03:18 PM6/18/12
to jasmi...@googlegroups.com
I have a Rails engine, and I wish to test some js using jasmine and jasminerice.

But I'm stymied right from the start because, after adding the gems and running rails g jasmine:install. I still don't see jasmine in the results from rake routes.

Also rake jasmine fails with "don't know how to build task 'jasmine'"

It seems as if I've run into this before, and failed, trying to load/run one engine (jasminerice) from another (my engine under test).

Has anyone succeeded in testing the js in a Rails engine using jasmine?

Rails version is 3.2.6.

thanks in advance

Les

Les Nightingill

unread,
Jul 12, 2012, 8:35:35 AM7/12/12
to jasmi...@googlegroups.com
Tony, I never made any progress on this. 

The problem I had relates to jasminerice which is a rails engine. It adds a route /jasmine to the set of routes. But I couldn't run jasminerice from the engine-under-test.

I am using jasminerice b/c I have not succeeded in getting the jasmine server to run the rails asset pipeline. But I think others may have succeeded in this, so since you've figured out how to start the jasmine server from your engine, perhaps this approach will work for you.

good luck

Les

On Wednesday, July 11, 2012 6:32:01 PM UTC-7, Tony Breckner wrote:
Hi Les, 
I appear to have made some progress.

If you cd into the Rails Engine and do a "rake -T jasmine" you will see 

rake app:jasmine     # Run specs via server
rake app:jasmine:ci  # Run continuous integration tests

So it appears that in an engine, most of the rake tasks are preceded by "app:"

As for testing on CI, all I can recommend at this stage is you would have to go into the engine's directory and run "rake app:jasmine:ci". I don't know how to rake it from the main project as of yet.

Tony
Reply all
Reply to author
Forward
0 new messages