Skip to content

Commit

Permalink
Fully qualify all constants.
Browse files Browse the repository at this point in the history
On 1.9.2 I was getting failures like:

uninitialized constant BasicObject::Hash
  • Loading branch information
myronmarston committed Apr 8, 2013
1 parent af7fa11 commit 3d664b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rspec/mocks/syntax.rb
Expand Up @@ -22,7 +22,7 @@ def should_not_receive(message, &block)
end

def stub(message_or_hash, opts={}, &block)
if Hash === message_or_hash
if ::Hash === message_or_hash
message_or_hash.each {|message, value| stub(message).and_return value }
else
::RSpec::Mocks.proxy_for(self).add_stub(caller(1)[0], message_or_hash.to_sym, opts, &block)
Expand All @@ -34,17 +34,17 @@ def unstub(message)
end

def stub!(message_or_hash, opts={}, &block)
RSpec::Mocks.warn_deprecation "\nDEPRECATION: use #stub instead of #stub!. #{caller(0)[1]}\n"
::RSpec::Mocks.warn_deprecation "\nDEPRECATION: use #stub instead of #stub!. #{caller(0)[1]}\n"
stub(message_or_hash, opts={}, &block)
end

def unstub!(message)
RSpec::Mocks.warn_deprecation "\nDEPRECATION: use #unstub instead of #unstub!. #{caller(0)[1]}\n"
::RSpec::Mocks.warn_deprecation "\nDEPRECATION: use #unstub instead of #unstub!. #{caller(0)[1]}\n"
unstub(message)
end

def stub_chain(*chain, &blk)
StubChain.stub_chain_on(self, *chain, &blk)
::RSpec::Mocks::StubChain.stub_chain_on(self, *chain, &blk)
end

def as_null_object
Expand Down

0 comments on commit 3d664b0

Please sign in to comment.