add expert factory
This commit is contained in:
parent
da067597ab
commit
efbff0f2e0
2 changed files with 15 additions and 1 deletions
14
spec/factories/expert.rb
Normal file
14
spec/factories/expert.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
FactoryBot.define do
|
||||
sequence(:create_expert_email) { |n| "expert#{n}@expert.com" }
|
||||
|
||||
factory :expert do
|
||||
transient do
|
||||
email { generate(:expert_email) }
|
||||
password { 'somethingverycomplated!' }
|
||||
end
|
||||
|
||||
initialize_with do
|
||||
User.create_or_promote_to_expert(email, password).expert
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
RSpec.describe Expert, type: :model do
|
||||
describe 'an expert could be add to a procedure' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:expert) { Expert.create }
|
||||
let(:expert) { create(:expert) }
|
||||
|
||||
before do
|
||||
procedure.experts << expert
|
||||
|
|
Loading…
Reference in a new issue