Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only reset any_instance recorder once.

  • Loading branch information...
commit 189fda06c40f8b2975079c67584398303031e96f 1 parent ef65d36
@dchelimsky dchelimsky authored
View
5 lib/rspec/mocks/any_instance.rb
@@ -234,13 +234,8 @@ def rspec_verify
__recorder.verify
super
ensure
- rspec_reset
- end
-
- def rspec_reset
__recorder.stop_observing!
@__recorder = nil
- super
end
def __recorder
View
9 spec/rspec/mocks/any_instance_spec.rb
@@ -482,7 +482,7 @@ class RSpec::SampleRspecTestClass;end
end
end
- context "when resetting after an example" do
+ context "when resetting post-verification" do
let(:space) { RSpec::Mocks::Space.new }
context "existing method" do
@@ -497,7 +497,7 @@ class RSpec::SampleRspecTestClass;end
end
it "restores the class to its original state after each example when no instance is created" do
- space.reset_all
+ space.verify_all
klass.method_defined?(:__existing_method_without_any_instance__).should be_false
klass.new.existing_method.should eq(existing_method_return_value)
@@ -506,7 +506,7 @@ class RSpec::SampleRspecTestClass;end
it "restores the class to its original state after each example when one instance is created" do
klass.new.existing_method
- space.reset_all
+ space.verify_all
klass.method_defined?(:__existing_method_without_any_instance__).should be_false
klass.new.existing_method.should eq(existing_method_return_value)
@@ -516,7 +516,7 @@ class RSpec::SampleRspecTestClass;end
klass.new.existing_method
klass.new.existing_method
- space.reset_all
+ space.verify_all
klass.method_defined?(:__existing_method_without_any_instance__).should be_false
klass.new.existing_method.should eq(existing_method_return_value)
@@ -556,7 +556,6 @@ class RSpec::SampleRspecTestClass;end
klass.any_instance.should_receive(:existing_method).and_return(Object.new)
klass.new.existing_method
space.verify_all
- space.reset_all
klass.new.existing_method.should eq(existing_method_return_value)
end
Please sign in to comment.
Something went wrong with that request. Please try again.