Lifecycle/space fixups #519
We don't need to reset the mock proxy while verifying it. That'll happen later during the teardown phase. It looks like the main reason we were doing this was to assist with rspec-mocks testing itself; we would verify the middle of an example to assert a mock expectation failure, and a `reset` is needed so it doesn't fail again when rspec-core calls `verify` as well. The solution is to use spec helper methods that perform the reset when we verify in the middle of an example. I don't have any evidence this improves perf, but it seems reasonable to assume that removing an extra method call per example can only make it faster (however slight the improvement may be). Fixes #165.
We're going to change the behavior of test doubles that have been reset (so that they "expire" and can no longer be used). This spec was originally added in 847c66d where the point was to address an error while resetting a test double (which, in turn caused that method double to stick around into later examples and continue to fail).
Test doubles are not designed to be used outside of the example they were created in.
* This should be faster (but almost certainly not noticably so). * It was odd to expose these methods off of `RSpec::Mocks` given that they are not intended for usage outside rspec-mocks. * We weren't getting any benefit from these except for not having to type `.space`.
When rspec-expectations tries to diff the object in a failure message, it blows up when the `pp` library tries to print it.
rspec-mocks lacks the necessary sandboxing to safely define and run examples from within examples. rspec-core has and uses this but it's not exposed for use here. Instead, we can just trigger the teardown/setup that happens between examples. This fixes some rspec-mocks space leakage that was happening.
Since we now use a new space instance per example, we don't need to clear its collections when resetting. Before this was necessary because we kept a space instance that we would keep using for the lifetime of the process. Constant mutators weren't being reset idempotently, so I had to tweak them a bit.
This was referenced
Jan 7, 2014
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.