demarches-normaliennes/spec/models/expert_spec.rb
2021-01-20 18:03:06 +01:00

15 lines
532 B
Ruby

RSpec.describe Expert, type: :model do
describe 'an expert could be add to a procedure' do
let(:procedure) { create(:procedure) }
let(:expert) { create(:expert) }
before do
procedure.experts << expert
procedure.reload
end
it { expect(procedure.experts).to eq([expert]) }
it { expect(ExpertsProcedure.where(expert: expert, procedure: procedure).count).to eq(1) }
it { expect(ExpertsProcedure.where(expert: expert, procedure: procedure).first.allow_decision_access).to be_falsy }
end
end