[#1677] Prevent invites from submitting a dossier
This commit is contained in:
parent
b869efd7d1
commit
dd219d5d40
2 changed files with 21 additions and 3 deletions
|
@ -3,14 +3,14 @@ require 'spec_helper'
|
|||
describe NewUser::DossiersController, type: :controller do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
describe 'before_actions: ensure_ownership, ensure_ownership_or_invitation!' do
|
||||
it 'is present' do
|
||||
describe 'before_actions' do
|
||||
it 'are present' do
|
||||
before_actions = NewUser::DossiersController
|
||||
._process_action_callbacks
|
||||
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||
.map(&:filter)
|
||||
|
||||
expect(before_actions).to include(:ensure_ownership!, :ensure_ownership_or_invitation!)
|
||||
expect(before_actions).to include(:ensure_ownership!, :ensure_ownership_or_invitation!, :forbid_invite_submission!)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -314,6 +314,13 @@ describe NewUser::DossiersController, type: :controller do
|
|||
it { expect(dossier.reload.state).to eq('brouillon') }
|
||||
end
|
||||
|
||||
context 'and the invite tries to submit the dossier' do
|
||||
before { subject }
|
||||
|
||||
it { expect(response).to redirect_to(root_path) }
|
||||
it { expect(flash.alert).to eq("Vous n'avez pas accès à ce dossier") }
|
||||
end
|
||||
|
||||
context 'and the invite updates a dossier en constructions' do
|
||||
before do
|
||||
dossier.en_construction!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue