jasmine / jasmine-gem

Jasmine ruby gem
682 stars 274 forks source link

Add application asset directories to spec pipeline #211

Closed nertzy closed 10 years ago

nertzy commented 10 years ago

That way, you can require vendor JS files loaded from gems, etc.

For example, if you want to include “angular-mocks.js” from the angularjs-rails gem, you can make a file in spec/javascripts/helpers with a //= require angular-mocks Sprockets directive.

nertzy commented 10 years ago

We picked vendor/assets because we felt that people shouldn't be able to require their app/assets code into their tests. Seems like there isn't a good use case for re-including code from the applications into the specs. I could imagine it causing confusion, or worse, false greens where the specs include necessary dependencies but somehow the src files never do.

But that said, it is pretty hacky to try to figure out which directories are for vendor assets. It works just fine to just remove the grep(/vendor\/assets/) and add all paths instead.

Either way, I think that keeping the pipelines separate but copying the paths over is the way to go, as opposed to directly reusing the Rails asset pipeline. Right now, for example, jasminerice pollutes the application pipeline with the spec path, so it's possible that its test harness will generate different src code than the application itself.

So we'll re-push without the vendor/assets part.

nertzy commented 10 years ago

Forgot to mention, this is a fix for issue #209

nertzy commented 10 years ago

+cc @vsanta

ragaskar commented 10 years ago

Thanks!

R.