Skip to content

Commit

Permalink
[#9513] add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mmagn committed Nov 18, 2024
1 parent 8ae2f7d commit 5a9c80a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/models/procedure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,15 @@
expect(procedure.revisions).to eq([procedure.published_revision, procedure.draft_revision])
end
end

context 'when publishing a procedure with the same path as another procedure from another admin' do
let(:procedure) { create(:procedure, path: 'example-path', administrateurs: [administrateur]) }
let(:other_procedure) { create(:procedure, path: 'example-path', administrateurs: [create(:administrateur)]) }

it 'raises an error' do
expect { procedure.publish_or_reopen!(administrateur, other_procedure.path) }.to raise_error(ActiveRecord::RecordInvalid)
end
end
end

describe "#publish_revision!" do
Expand Down

0 comments on commit 5a9c80a

Please sign in to comment.