[rspec-users] Validations aren't being performed when running 'rspec spec'

Craig Demyanovich cdemyanovich at gmail.com
Thu Feb 24 14:26:55 EST 2011


On Thu, Feb 24, 2011 at 2:07 PM, Tom Milewski <tmilewski at gmail.com> wrote:

> Thanks for the replies.
>
> Here's the error I'm seeing when running all specs (.build
> and .create):
>
> Agent while creating should ensure that name is present
>     Failure/Error: Factory(:public_agent, :name => nil).should
> have(1).error_on(:name)
>        expected 1 error on :name, got 0
>     # ./spec/models/agent_spec.rb:35:in `block (3 levels) in <top
> (required)>'
>
> Here's what I'm seeing when running model specs with .create:
>
> Agent while creating should ensure that name is present
>     Failure/Error: Factory(:public_agent, :name => nil).should
> have(1).error_on(:name)
>      ActiveRecord::RecordInvalid:
>       Validation failed: Name can't be blank
>     # ./spec/models/agent_spec.rb:35:in `block (3 levels) in <top
> (required)>'
>
> Everything passes when running model specs with .build.
>

Have you tried with Agent.new and/or Agent.create? Maybe factory_girl is
doing something strange.

Also, what versions of rails, rspec-rails, rspec and factory_girl are you
using?

Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110224/f255bd9f/attachment.html>


More information about the rspec-users mailing list