[rspec-devel] [ rspec-Bugs-7611 ] Partial Mocks override Subclass methods

noreply at rubyforge.org noreply at rubyforge.org
Tue Jan 30 17:34:38 EST 2007


Bugs item #7611, was opened at 2007-01-06 00:35
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=7611&group_id=797

>Category: mock module
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Brian Takita (btakita)
>Assigned to: David Chelimsky (dchelimsky)
Summary: Partial Mocks override Subclass methods

Initial Comment:
Here is a quick error case that is order dependent. The first spec must run first. I'll post a better spec later.

require "rubygems"
require "spec"

class Foo
end

class Bar < Foo
end

context "A Partial Mock" do
  specify "should respect subclasses" do
    Foo.stub!(:new).and_return(Object.new)
  end

  specify "should" do
    Bar.new.class.should == Bar
  end
end

# output

.F

1)
'A Partial Mock should' FAILED
Foo should == Bar
/home/btakita/workspace/scratch/lib/bdd/partial_mock_subclass_bug.rb:17:
/home/btakita/workspace/scratch/lib/bdd/partial_mock_subclass_bug.rb:11:

Finished in 0.001406 seconds

2 specifications, 1 failure


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

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-30 22:34

Message:
Fixed in rev 1447

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

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


More information about the rspec-devel mailing list