× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

FactoryGirl confirmed user

Mehmet Beydogan
Oct 07, 2015
<p>When using FactoryGirl and Devise, the users created by factory is not confirmed. You can make them confirmed at creation instead of calling <strong>user.confirm! </strong>everytime. You can do it adding the following line to your factory;</p> <pre><code class="language-ruby">confirmed_at Time.now</code></pre> <p> </p> <p>An example factory would be;</p> <p> </p> <pre><code class="language-ruby"> factory :employer do email { Faker::Internet.email } password "foobar" password_confirmation "foobar" firstname { Faker::Name.first_name } lastname { Faker::Name.last_name } confirmed_at Time.now end </code></pre> <p> </p>
comments powered by Disqus