[Fix #2145] When procedure is archived, usager should see a message explaining dossier submission is closed

This commit is contained in:
Mathieu Magnin 2018-06-25 18:07:16 +02:00
parent 9afbd16bbf
commit e694e7f9b9
7 changed files with 123 additions and 33 deletions

View file

@ -25,4 +25,61 @@ RSpec.describe DossierHelper, type: :helper do
it { is_expected.to eq nil }
end
end
describe ".dossier_submission_is_closed?" do
let(:dossier) { create(:dossier, state: state) }
let(:state) { "brouillon" }
subject { dossier_submission_is_closed?(dossier) }
context "when dossier state is brouillon" do
it { is_expected.to be false }
context "when dossier state is brouillon and procedure is archivee" do
before { dossier.procedure.archive }
it { is_expected.to be true }
end
end
shared_examples_for "returns false" do
it { is_expected.to be false }
context "and procedure is archivee" do
before { dossier.procedure.archive }
it { is_expected.to be false }
end
end
context "when dossier state is en_construction" do
let(:state) { "en_construction" }
it_behaves_like "returns false"
end
context "when dossier state is en_construction" do
let(:state) { "en_instruction" }
it_behaves_like "returns false"
end
context "when dossier state is en_construction" do
let(:state) { "accepte" }
it_behaves_like "returns false"
end
context "when dossier state is en_construction" do
let(:state) { "refuse" }
it_behaves_like "returns false"
end
context "when dossier state is en_construction" do
let(:state) { "sans_suite" }
it_behaves_like "returns false"
end
end
end