Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Add application asset directories to spec pipeline #211

Merged
merged 1 commit into from May 19, 2014

Conversation

nertzy
Copy link

@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
Copy link
Author

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.

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.
@nertzy nertzy changed the title Add vendor/assets directories to spec pipeline Add application asset directories to spec pipeline May 19, 2014
@nertzy
Copy link
Author

nertzy commented May 19, 2014

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

@nertzy
Copy link
Author

nertzy commented May 19, 2014

+cc @vsanta

ragaskar added a commit that referenced this pull request May 19, 2014
Add application asset directories to spec pipeline
@ragaskar ragaskar merged commit 187c9fb into jasmine:master May 19, 2014
@ragaskar
Copy link
Contributor

Thanks!

R.

@nertzy nertzy deleted the add-vendor-assets-to-spec-pipeline branch May 19, 2014 19:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants