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

Allow specs inside subdirectories of {app,lib}/assets/javascripts/spec/ #21

Merged
merged 3 commits into from Feb 4, 2014

Conversation

andriusch
Copy link
Contributor

Old code would treat subdirectory itself as a spec file and then fail to find any tests within it. This code fixes that by instead searching for spec files inside it. Not sure if it should search for files ending with _spec or accept all files.

There didn't seem to be any tests for that so I simply added new spec in subdirectory of test app.

end

def spec_files_for_glob glob = '**'
Dir[Rails.root.join("{app,lib}/assets/javascripts/spec/#{glob}{,_spec{.js,}.{rb,opal}}")].map do |path|
Dir[Rails.root.join("{app,lib}/assets/javascripts/spec/#{glob}.{rb,opal}")].map do |path|
Copy link
Member

Choose a reason for hiding this comment

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

I'll probably redo this change as follows:

spec_files_for_glob '**'
# […]
Dir[Rails.root.join("{app,lib}/assets/javascripts/spec/#{glob}{_spec{.js,}.{rb,opal}}")].map do |path|

Removing that leading comma should be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I thought at first, however that way it doesn't work anymore when trying to run a single spec file using pattern param.

Copy link
Member

Choose a reason for hiding this comment

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

can you expand on this? I'd like to turn it into a spec (or two)

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've added a spec for this in my other commit.

@elia
Copy link
Member

elia commented Feb 3, 2014

Thanks

There are three failures on jenkins, a couple seem to be related to the source-maps comment that changed format, the other just doesn't expect the file you added, all should be easy to fix.

@andriusch
Copy link
Contributor Author

Sorry somehow I missed spec directory... Fixed spec related to my changes and added a new spec to check running single file.
As for source maps they don't seem to be related to my changes as they were failing before my changes, probably best to fix those separately from this issue.

@elia
Copy link
Member

elia commented Feb 3, 2014

👍 almost there:

 expected there to be content "Running: subdirectory/example_spec.js example_spec" in "Running:\nexample_spec.js\nsubdirectory/example_spec.js\nRSpec Code Examples\nPassed Failed Pending\n2 examples, 0 failures\nFinished in 0.02200 seconds\na running spec\nruns successfully\n0.00600s\nspec inside subdirectory\nruns fine\n0.00200s"

The order of spec files seems to be random (or system dependent) can you split that expectation like this?

page.should have_content('subdirectory/other_spec.js')
page.should have_content('example_spec')

@andriusch
Copy link
Contributor Author

Should be fixed, travis doesn't seem to run automatically though?

@elia
Copy link
Member

elia commented Feb 4, 2014

Thanks, merging (and then fixing the sourmaps specs)

elia added a commit that referenced this pull request Feb 4, 2014
Allow specs inside subdirectories of {app,lib}/assets/javascripts/spec/
@elia elia merged commit b9fe215 into opal:master Feb 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants