Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extracted traits from users factories

  • Loading branch information...
commit e7a67a50bc47193eb875bc5683efc5b41542169e 1 parent 3358e92
@4r2r 4r2r authored timurvafin committed
View
17 spec/factories/users.rb
@@ -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
View
4 spec/features/step_definitions/authentication_steps.rb
@@ -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
View
2  spec/features/step_definitions/visitor/sign_in_steps.rb
@@ -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
View
5 spec/features/step_definitions/visitor/sign_up_steps.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.