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

noreply at rubyforge.org noreply at rubyforge.org
Fri Jan 5 19:35:25 EST 2007


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

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
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


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

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