Forum: RSpec method calls count weirdness.

Posted by apneadiving (Guest)
on 2012-01-27 17:39
(Received via mailing list)
Hi,

I see a really weird behavior there, the following test passes:

  it "test", :focus do
    doc = Factory.build(:document)
    doc.should_receive(:update_project!).exactly(2).times
    doc.save
  end

But when I do:

def update_project!
  binding.pry
  #some stuff
end
I enter the method 3 times through pry...

3 vs 2, who is right?
Posted by apneadiving (Guest)
on 2012-01-27 18:35
(Received via mailing list)
Sorry, the mistake came from the factory itself.

Indeed, the Factory call I really make is slightly different and for a
still unknown reason (asked on factory girl google's group), the build
method actually created the object...
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.