[rspec-devel] [ rspec-Bugs-12865 ] Partial mock error when object has an @options instance var

noreply at rubyforge.org noreply at rubyforge.org
Mon Aug 6 23:45:18 EDT 2007


Bugs item #12865, was opened at 2007-08-07 03:37
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12865&group_id=797

Category: mock module
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
Assigned to: David Chelimsky (dchelimsky)
Summary: Partial mock error when object has an @options instance var

Initial Comment:
The following fails:

describe "partial mock" do
  it "should not conflict with @options in the object" do
    @object = Object.new
    @object.instance_eval { @options = Object.new }
    @object.should_receive(:blah)
    @object.blah
  end
end

... with this error:

can't convert Object into Hash.

The problem is in spec/mocks/methods in __mock_proxy:

  def __mock_proxy
    @mock_proxy ||= Proxy.new(self, @name, @options)
  end

The @options argument is meaningful in an instance of Spec::Mocks::Mock, but not in an any other object.



----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-07 03:45

Message:
Fixed in r2307

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12865&group_id=797


More information about the rspec-devel mailing list