Closed alexeyzab closed 9 years ago
Found more in another code sample, same chapter.
# DON'T do this
factory :admin_user, class: User do
sequence(:username) { |n| "admin_username#{n}" }
password_digest "password
name "Mr. Admin"
age 27
admin true
end
factory :normal_user, class: User do
sequence(:username) { |n| "username#{n}" }
password_digest "password
name "Donald Duck"
age 24
admin false
end
# DO this
factory :user do
sequence(:username) { |n| "username#{n}" }
password_digest "password
trait :admin do
admin true
end
end
Same thing, missing quotes.
Fixed in #48.
Hi there!
I think I found a typo inside a code sample in this file: testing-rails/book/antipatterns/using_factories_like_fixtures.md
It should be
Notice the quote sign after the "password.
Mind if I submit a pull request?