[#2604] Factor AssignTo spec
This commit is contained in:
parent
dd80cc280a
commit
86f01a9120
1 changed files with 7 additions and 6 deletions
|
@ -1,17 +1,18 @@
|
|||
describe AssignTo, type: :model do
|
||||
describe '#procedure_presentation_or_default' do
|
||||
context "without a procedure_presentation" do
|
||||
let!(:assign_to) { AssignTo.create }
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:assign_to) { AssignTo.create(procedure: procedure) }
|
||||
|
||||
it { expect(assign_to.procedure_presentation_or_default.persisted?).to be_falsey }
|
||||
let(:procedure_presentation_or_default) { assign_to.procedure_presentation_or_default }
|
||||
|
||||
context "without a procedure_presentation" do
|
||||
it { expect(procedure_presentation_or_default.persisted?).to be_falsey }
|
||||
end
|
||||
|
||||
context "with a procedure_presentation" do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let!(:assign_to) { AssignTo.create(procedure: procedure) }
|
||||
let!(:procedure_presentation) { ProcedurePresentation.create(assign_to: assign_to) }
|
||||
|
||||
it { expect(assign_to.procedure_presentation_or_default).to eq(procedure_presentation) }
|
||||
it { expect(procedure_presentation_or_default).to eq(procedure_presentation) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue