FactoryBot.define do sequence (:email) {|n| "testuser#{n}@fet.at"} factory :user do email password {"password"} password_confirmation {"password"} factory :other_user do email {"othertest@test.at"} end trait :fetuser do after(:create) do |user| user.add_role("fetuser") end end end end