[Fix #2604] Handle ProcedurePresentations that have gone invalid
This commit is contained in:
parent
7baa239095
commit
14fd60bee7
3 changed files with 45 additions and 1 deletions
|
@ -9,6 +9,7 @@ describe AssignTo, type: :model do
|
|||
|
||||
context "without a procedure_presentation" do
|
||||
it { expect(procedure_presentation_or_default).not_to be_persisted }
|
||||
it { expect(procedure_presentation_or_default).to be_valid }
|
||||
it { expect(errors).to be_nil }
|
||||
end
|
||||
|
||||
|
@ -16,7 +17,24 @@ describe AssignTo, type: :model do
|
|||
let!(:procedure_presentation) { ProcedurePresentation.create(assign_to: assign_to) }
|
||||
|
||||
it { expect(procedure_presentation_or_default).to eq(procedure_presentation) }
|
||||
it { expect(procedure_presentation_or_default).to be_valid }
|
||||
it { expect(errors).to be_nil }
|
||||
end
|
||||
|
||||
context "with an invalid procedure_presentation" do
|
||||
let!(:procedure_presentation) do
|
||||
pp = ProcedurePresentation.new(assign_to: assign_to, displayed_fields: [{ 'table' => 'invalid', 'column' => 'random' }])
|
||||
pp.save(validate: false)
|
||||
pp
|
||||
end
|
||||
|
||||
it { expect(procedure_presentation_or_default).not_to be_persisted }
|
||||
it { expect(procedure_presentation_or_default).to be_valid }
|
||||
it { expect(errors).to be_present }
|
||||
it do
|
||||
procedure_presentation_or_default
|
||||
expect(assign_to.procedure_presentation).not_to be(procedure_presentation)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue