demarches-normaliennes/spec/views/users/dossiers/_dossier_actions.html.haml_spec.rb

22 lines
998 B
Ruby
Raw Normal View History

2019-03-26 17:55:40 +01:00
describe 'users/dossiers/dossier_actions.html.haml', type: :view do
let(:procedure) { create(:procedure, :published) }
2019-03-26 17:55:40 +01:00
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
let(:user) { dossier.user }
2019-03-26 17:55:40 +01:00
subject { render 'users/dossiers/dossier_actions.html.haml', dossier: dossier, current_user: user }
2019-03-26 17:55:40 +01:00
it { is_expected.to have_link('Commencer un autre dossier', href: commencer_url(path: procedure.path)) }
2021-12-08 12:27:12 +01:00
it { is_expected.to have_link('Supprimer le dossier', href: delete_dossier_dossier_path(dossier)) }
it { is_expected.to have_link('Transferer le dossier', href: transferer_dossier_path(dossier)) }
2019-03-26 17:55:40 +01:00
2021-12-08 12:27:12 +01:00
context 'when the dossier is termine' do
2019-03-26 17:55:40 +01:00
let(:dossier) { create(:dossier, :accepte, procedure: procedure) }
2021-12-08 12:27:12 +01:00
it { is_expected.to have_link('Supprimer le dossier') }
2019-03-26 17:55:40 +01:00
end
context 'when the procedure is closed' do
let(:procedure) { create(:procedure, :closed) }
it { is_expected.not_to have_link('Commencer un autre dossier') }
end
2019-03-26 17:55:40 +01:00
end