Why should_receive doesn't work, but stub does

before(:each) do
@myinstance = GetHtml.new
end

it “should be a Hyricot” do
hy = open(‘test.html’) {|f| Hpricot f}
@myinstance.should_receive(:find_html).with(“file:///test_url”).and_return(hy)

end
++++++++++++++++++++++++++++++++++
it “should be a Hyricot” do
hy = open(‘test.html’) {|f| Hpricot f}
@myinstance.stub!(:find_html).with(“file:///test_url”).and_return(hy)

end
++++++++++++++++++++++++++++++++++

expected … once, but received it 0 times

I have a find_html method in my GetHtml class, but why can’t
should_receive run successfuly? but use stub!, it can.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs