Permalink
Browse files

Extracted traits from users factories

  • Loading branch information...
1 parent 3358e92 commit e7a67a50bc47193eb875bc5683efc5b41542169e @4r2r 4r2r committed with timurvafin Oct 11, 2012
@@ -1,15 +1,16 @@
FactoryGirl.define do
factory :user do
- full_name 'John Smith'
email
- password '123456'
- factory :confirmed_user do
- confirmed_at 1.hour.ago
- end
+ full_name 'John Smith'
+ password '123456'
+ end
+
+ trait :confirmed do
+ confirmed_at 1.hour.ago
+ end
- factory :not_confirmed_user do
- confirmed_at nil
- end
+ trait :not_confirmed do
+ confirmed_at nil
end
end
@@ -1,9 +1,9 @@
step 'I exist as a user' do
- @current_user = FactoryGirl.create :confirmed_user
+ @current_user = FactoryGirl.create :user, :confirmed
end
step 'I am signed in' do
- @current_user = FactoryGirl.create :confirmed_user
+ @current_user = FactoryGirl.create :user, :confirmed
sign_in_with @current_user.email, "123456"
end
@@ -9,7 +9,7 @@ def sign_in_with(email, password)
step 'I exist as a user with not confirmed email' do
- @current_user = FactoryGirl.create :not_confirmed_user
+ @current_user = FactoryGirl.create :user, :not_confirmed
end
step 'I sign in with valid credentials' do
@@ -23,7 +23,10 @@ def register
end
step 'I submit resent confirmation instruction form' do
- FactoryGirl.create :not_confirmed_user, email: "chuck.norris@example.com", full_name: "Chuck Norris"
+ FactoryGirl.create :user,
+ :not_confirmed,
+ email: "chuck.norris@example.com",
+ full_name: "Chuck Norris"
visit new_user_confirmation_path

0 comments on commit e7a67a5

Please sign in to comment.