Factory Girl sequence fails under autospec

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-06-09T23:55:20Z Indexed on 2010/06/10 0:02 UTC
Read the original article Hit count: 363

Filed under:
|
|

I have this Factory:

Factory.define :email_address do |e|
  e.sequence(:address) { |n| "factory_#{n}@example.com" }
  e.validated true
end

When I run my specs with rake spec, it works fine.

When I run autospec, it fails right away, claiming that the email address is being used twice in two different objects (there is a validation which restricts this).

Why is it behaving differently under autospec?

Thanks, John

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rspec