-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
RSpec runs specs twice when run from within ruby and file is reloaded between subsequent runs #826
Comments
I'm attaching part of output from run of this sample script mentioned above: ruby run_spec_in_loop.rb
Running spec from within ruby runtime
.
Finished in 0.00047 seconds
1 example, 0 failures
loading spec file via 'load' as if it was changed and we wanted changes to be picked up
Running spec from within ruby runtime
..
Finished in 0.001 seconds
2 examples, 0 failures |
Hey, the whole purpose of the runner is to allow you to customise what specs are run from your own tools, there are various projects that do this sort of thing on MRI Ruby, e.g. |
You're right but the thing is guard-rspec executes on fresh runner every time (what causes delays on JRuby) .What I want to do is to have runner instance configured and just run spec I want using this instance. But when I try to do that after reloading specs file it executes those specs twice. |
The RSpec runner is already calling I quickly knocked up a script based off your example which reruns a single spec file, changes the specs to something else, then reruns them, work's correctly without the second |
Hey @mostr, I'm going to close this now, I hope my last tip helped you out, but this doesn't seem like an issue within RSpec itself. |
Yeah, thanks a lot, your tip was very helpful. |
No worries. :) |
I'd like to run specs from withing ruby runtime every time my spec or lib file changes. Unfortunately it looks like RSpec runs the same specs twice when file is
load
-ed between subsequent runs. I'm using JRuby and to eliminate JVM startup time I'd like to fire my ruby runtime once, load all my stuff on start and then reload only files changed.I've created tiny project showing this issue live https://github.com/mostr/rspec_double_run_issue.
Is there a way to cleanup RSpec "context" between subsequent runs when run with
RSpec::Core::Runner.run
?The text was updated successfully, but these errors were encountered: