tests
This commit is contained in:
parent
328c2a8e3c
commit
81f5a5254b
16 changed files with 544 additions and 674 deletions
|
@ -1,12 +1,15 @@
|
|||
describe 'instructeurs/avis/instruction.html.haml', type: :view do
|
||||
let(:expert) { create(:instructeur) }
|
||||
let(:avis) { create(:avis, confidentiel: confidentiel, email: expert.email) }
|
||||
describe 'experts/avis/instruction.html.haml', type: :view do
|
||||
let(:expert) { create(:expert) }
|
||||
let(:claimant) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure) }
|
||||
let!(:avis) { create(:avis, confidentiel: confidentiel, claimant: claimant, experts_procedure: experts_procedure) }
|
||||
let!(:experts_procedure) { ExpertsProcedure.create(expert: expert, procedure: procedure) }
|
||||
|
||||
before do
|
||||
assign(:avis, avis)
|
||||
assign(:new_avis, Avis.new)
|
||||
assign(:dossier, avis.dossier)
|
||||
allow(view).to receive(:current_instructeur).and_return(avis.instructeur)
|
||||
allow(view).to receive(:current_expert).and_return(avis.expert)
|
||||
end
|
||||
|
||||
subject { render }
|
|
@ -4,7 +4,10 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
|
|||
subject { render 'instructeurs/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur }
|
||||
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:avis) { [create(:avis, claimant: instructeur)] }
|
||||
let(:expert) { create(:expert) }
|
||||
let!(:dossier) { create(:dossier) }
|
||||
let(:experts_procedure) { ExpertsProcedure.create(expert: expert, procedure: dossier.procedure) }
|
||||
let(:avis) { [create(:avis, claimant: instructeur, experts_procedure: experts_procedure)] }
|
||||
let(:seen_at) { avis.first.created_at + 1.hour }
|
||||
|
||||
it { is_expected.to have_text(avis.first.introduction) }
|
||||
|
@ -17,7 +20,7 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
|
|||
end
|
||||
|
||||
context 'with an answer' do
|
||||
let(:avis) { [create(:avis, :with_answer, claimant: instructeur)] }
|
||||
let(:avis) { [create(:avis, :with_answer, claimant: instructeur, experts_procedure: experts_procedure)] }
|
||||
|
||||
it 'renders the answer formatted with newlines' do
|
||||
expect(subject).to include(simple_format(avis.first.answer))
|
||||
|
|
|
@ -12,7 +12,6 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
|
|||
|
||||
context "there are some champs" do
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:avis) { create :avis, dossier: dossier, instructeur: instructeur }
|
||||
let(:champ1) { create(:champ_checkbox, dossier: dossier, value: "on") }
|
||||
let(:champ2) { create(:champ_header_section, dossier: dossier, value: "Section") }
|
||||
let(:champ3) { create(:champ_explication, dossier: dossier, value: "mazette") }
|
||||
|
@ -20,8 +19,6 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
|
|||
let(:champ5) { create(:champ_textarea, dossier: dossier, value: "Some long text in a textarea.") }
|
||||
let(:champs) { [champ1, champ2, champ3, champ4, champ5] }
|
||||
|
||||
before { dossier.avis << avis }
|
||||
|
||||
it "renders titles and values of champs" do
|
||||
expect(subject).to include(champ1.libelle)
|
||||
expect(subject).to include(champ1.value)
|
||||
|
@ -29,7 +26,6 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
|
|||
expect(subject).to have_css(".header-section")
|
||||
expect(subject).to include(champ2.libelle)
|
||||
|
||||
expect(subject).to have_link("Dossier nº #{dossier.id}")
|
||||
expect(subject).to include(dossier.text_summary)
|
||||
|
||||
expect(subject).to include(champ5.libelle)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue