Forum: RSpec [RSpec] mock_model not returning a mock

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
49de4cd2f26705785cbef2b15a9df7aa?d=identicon&s=25 Nick Hoffman (nickh)
on 2009-02-12 19:58
(Received via mailing list)
I'm experiencing some strange behaviour with an ActiveRecord model
object. I'm trying to spec that a mocked AR object, @form, has an
error on the "file" attribute.

I've confirmed that there *is* an error on the "file" attribute,
because I print out the error.

However, the spec fails, saying that one error was expected, but zero
were found.

I've pasted some code to help with figuring this out:
http://pastie.org/387327

One thing that I've noticed is that if I comment this out in my spec:
   195       @form.valid?
then the spec passes.

Any idea what's going on? I'd really appreciate any help at all, as
I've been banging my head against this for a while, now.
-Nick
49de4cd2f26705785cbef2b15a9df7aa?d=identicon&s=25 Nick Hoffman (nickh)
on 2009-02-12 20:04
(Received via mailing list)
Ack, that subject is completely wrong! I forgot to update it after re-
writing the email.
This topic is locked and can not be replied to.