Permalink
Browse files

some mocks are not mocks

  • Loading branch information...
1 parent c8b9948 commit 17c259ea5143d309e90ca6d53d40f6356ac2d0a5 @dchelimsky dchelimsky committed Feb 8, 2012
Showing with 9 additions and 10 deletions.
  1. +6 −7 lib/rspec/mocks/space.rb
  2. +2 −2 spec/rspec/mocks/any_instance_spec.rb
  3. +1 −1 spec/rspec/mocks/mock_space_spec.rb
View
@@ -3,20 +3,20 @@ module Mocks
# @api private
class Space
def add(obj)
- mocks << obj unless mocks.detect {|m| m.equal? obj}
+ receivers << obj unless receivers.detect {|m| m.equal? obj}
end
def verify_all
- mocks.each do |mock|
+ receivers.each do |mock|
mock.rspec_verify
end
end
def reset_all
- mocks.each do |mock|
+ receivers.each do |mock|
mock.rspec_reset
end
- mocks.clear
+ receivers.clear
expectation_ordering.clear
end
@@ -26,10 +26,9 @@ def expectation_ordering
private
- def mocks
- @mocks ||= []
+ def receivers
+ @receivers ||= []
end
-
end
end
end
@@ -769,14 +769,14 @@ class RSpec::SampleRspecTestClass;end
it "adds an class to the current space when #any_instance is invoked" do
klass.any_instance
- RSpec::Mocks::space.send(:mocks).should include(klass)
+ RSpec::Mocks::space.send(:receivers).should include(klass)
end
it "adds an instance to the current space when stubbed method is invoked" do
klass.any_instance.stub(:foo)
instance = klass.new
instance.foo
- RSpec::Mocks::space.send(:mocks).should include(instance)
+ RSpec::Mocks::space.send(:receivers).should include(instance)
end
end
@@ -40,7 +40,7 @@ def reset?
it "clears internal mocks on reset_all" do
@space.add(double("mock"))
@space.reset_all
- @space.instance_eval { mocks.empty? }.should be_true
+ @space.instance_eval { receivers.empty? }.should be_true
end
it "resets the ordering" do
@space.reset_all

0 comments on commit 17c259e

Please sign in to comment.