Add application asset directories to spec pipeline #211

Merged
merged 1 commit into from May 19, 2014

Projects

None yet

2 participants

@nertzy
nertzy commented May 19, 2014

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
nertzy commented May 19, 2014

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.

Grant Hutchins and Vanessa Sant'Anna Add Rails asset pipeline directories to spec pipeline
That way, you can require 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.
5bea7c8
@nertzy nertzy changed the title from Add vendor/assets directories to spec pipeline to Add application asset directories to spec pipeline May 19, 2014
@nertzy
nertzy commented May 19, 2014

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

@nertzy
nertzy commented May 19, 2014

+cc @vsanta

@ragaskar ragaskar merged commit 187c9fb into jasmine:master May 19, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@ragaskar
Contributor

Thanks!

R.

@nertzy nertzy deleted the nertzy:add-vendor-assets-to-spec-pipeline branch May 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment