Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod support for test blueprints #2472

Merged
merged 1 commit into from
Nov 18, 2014
Merged

Conversation

trabus
Copy link
Contributor

@trabus trabus commented Nov 9, 2014

This PR adds --pod support for tests generated from blueprints as requested in issue #2414. Test blueprints for blueprints that support pods now have a __path__ token for the containing folder. The __path__ token now has some logic that determines if the blueprint name contains -test and adjusts accordingly.

A generated test is created in the following structure:

ember g route taco --pod

installing
  create app/taco/route.js
  create app/taco/template.hbs
installing
  create tests/unit/taco/route-test.js

@trabus
Copy link
Contributor Author

trabus commented Nov 9, 2014

Added a Changelog entry.

@stefanpenner
Copy link
Contributor

👍

@rwjblue
Copy link
Member

rwjblue commented Nov 10, 2014

LGTM

@jgwhite - Would you mind reviewing?

@return {Boolean}
*/
function isTestFile(file) {
return file.match(/-test/);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we anchor this to the end of the filename /-test\.js$/ just to be on the safe side?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to use path.extname and tack that on the end of the regexp (to support .coffee and other formats).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, I probably should have named that better, it changed from the original intent of checking against the files. I'm actually only checking the blueprint name for /-test/, not the files in the blueprint.

I'll probably remove it and just do the match in place.

@jgwhite
Copy link
Contributor

jgwhite commented Nov 10, 2014

One very minor comment but seems rad apart from that.

@@ -507,12 +507,20 @@ Blueprint.prototype._fileMapTokens = function(options) {
return options.dasherizedModuleName;
},
__path__: function(options) {
var blueprintName = options.blueprintName;

if(blueprintName.match(/-test/)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am now just using match against the blueprintName. isTestFile was no longer used or necessary, so I removed it.

@stefanpenner
Copy link
Contributor

needs a rebase

@trabus
Copy link
Contributor Author

trabus commented Nov 18, 2014

Something went sideways in the rebase. Working on it.

@trabus
Copy link
Contributor Author

trabus commented Nov 18, 2014

Travis is happy now.

stefanpenner added a commit that referenced this pull request Nov 18, 2014
Pod support for test blueprints
@stefanpenner stefanpenner merged commit 1fa7b8a into ember-cli:master Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants