On Dec 17, 12:16 pm, klochner <[email protected]> wrote:
> We're in a situation with tests passing individually, but one test failing
> when run in combination with the whole suite (rspec spec).
>
> It's some kind of conflict between VCR/webmock/capybara-webkit, with
> Timeout::Error exceptions when the specs using webkit are run after those
> using webmock.
>
> Short of patching the gems, how do people go about working around these
> kinds of conflicts?
>
>    - is there a global reset option in rspec for running the test in an
>    isolated "fresh" environment?
>    - any hacks to approximate a state reset?
>
> - Kevin

There are ways you can reset rspec's state (e.g. the examples it knows
about), but I don't think you want that.  The state that's causing you
trouble must be in one of the other gems, and rspec knows nothing
about them.

As for hacks to approximate a state reset: I'm sure you could iterate
over object space, and clear out instance variables on each object or
whatever, but I would NOT recommend going down that path.  Honestly,
tracking down and fixing the issue in the upstream gem is going to be
less work (and a far, far better solution).

I do have one suggestion, though: I use a couple different tools to
help surface problems like these right when they are introduced, so I
can address them early:

* I use rspec's `--order random` option to run my tests in random
order.  This surfaces any ordering issues.
* My normal flow is to run individual spec files when in my TDD loop,
then run everything together before committing or pushing.
* My CI builds also use something like rspec-core test_all script[1]
which runs the entire suite, then runs each spec file individually.
This ensures we know about any problems with running an individual
spec vs. running it in the context of the full suite.

HTH,
Myron

[1] https://github.com/rspec/rspec-core/blob/master/script/test_all#L15-L23

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to