Thanks for all of your insight guys.

As it turned out the culprit was
".any_instance.stubs(:valid?).returns(false)" which was being run in
the controllers.
I changed some things around any now everything is working as
expected.

I was using the following:

Rails 3.0.0
RSpec 2.4.0
RSpec Rails 2.4.1
Factory Girl 2.0.0.beta1

Thanks again!

On Feb 24, 2:26 pm, Craig Demyanovich <cdemyanov...@gmail.com> wrote:
> On Thu, Feb 24, 2011 at 2:07 PM, Tom Milewski <tmilew...@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
>
> _______________________________________________
> rspec-users mailing list
> rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to