-
-
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
Core::Runner.run runs two specs with line number (args), the second line number setting is ignored #621
Comments
RSpec is designed primarily to be used from the command line. Invoking the runner programmatically is supported, but we've never had a use case where someone was trying to run it twice in the same process. The issue is that there are a few global objects that are getting confused by trying to configure them twice. Can I ask why you don't just run these two together?
|
David, Thanks for quick response. Our application is a functional testing IDE, RSpec is the core framework used in test scripts. One of most used feature is to run the test case where the cursor is, like below: In other words, we pass line numbers to RSpec to run difference test cases. This works fine with RSpec 1.1.12. Now we are trying to upgrade to RSpec 2. |
@zhimin should work fine if you're only running time. Do you actually have a use case in which you run twice in the same process? |
@dchelimsky Yes, we have have a requirement to run difference behaviours in the same process. I experienced "All examples were filtered out" in my application when upgrade to RSpec 2, when I ran second behaviour in another test file after executing once with --line_number argument, which exhibited in the code exampled I posted here. I tried RSpec.reset. Also I could run another behaviour at different line number OK as long as it is the same test script file (the first one being executed). |
@zhimin after this fix you should be able to use |
@dchelimsky I applied the fix to RSpec lib, but the issue still remains. Here is my test case: https://gist.github.com/2722735 |
Interesting - the output now shows that it is trying to filter on line 10 the 2nd time (which it wasn't before), but apparently it's not quite working yet (even though I thought I saw it work before). I'll follow up when I have a better fix :) |
@dchelimsky Yes! It worked. Thanks heaps. |
Cool - I'll try to get this released this weekend either as 2.11 or at the very least as a patch release 2.10.1. |
@zhimin I haven't announced it yet, but I just released 2.10.1 with this fix. Announcement coming later today or tomorrow, but you are free to take advantage of it right away. |
@dchelimsky I updated to 2.10.1, works fine, thanks! |
This change affects Specjour, which invokes the runner multiple times within the same process. The issue occurs when using rspec-rails features that are included into the configuration object at require-time. Take The first test runs fine. When the configuration object is set to Specjour already does some monkey-patching, so I could monkey-patch my way out of this issue, but I figured I'd offer Specjour's perspective. Can we keep the configuration object around? |
@dchelimsky Yeah, that's OK. |
OK. I've reopened this issue and will update the code to require the user to use RSpec.reset - otherwise the configuration stays put. |
Sounds like a good solution. Thanks! Sent from my iPhone On Jun 9, 2012, at 5:22 AM, David Chelimskyreply@reply.github.com wrote:
|
Based on discussion in #703, this issue should be tagged as rspec-3. |
There's a new PR and discussion for this in #1443. Closing. |
- Fixes rspec/rspec-core#621 --- This commit was imported from rspec/rspec-core@b1dfc61.
This commit was imported from rspec/rspec-core@fffc4c5.
Hi,
I try to use Core::Runner.run to execute some tests within my application.
It executed first test OK, then ignore the line_number setting for the second one (still using the first setting), return 'All examples were filtered out'.
Is there anywhere to make Core::Runner.run always start fresh? Thanks.
Here are two simple specs (add_spec.rb, minus_spec.rb):
Regards,
Zhimin
The text was updated successfully, but these errors were encountered: