2023-03-06 15:51:08 +01:00
|
|
|
|
describe 'users/dossiers/show', type: :view do
|
2018-09-11 18:40:10 +02:00
|
|
|
|
let(:dossier) { create(:dossier, :en_construction) }
|
2018-08-07 16:32:11 +02:00
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
sign_in dossier.user
|
|
|
|
|
assign(:dossier, dossier)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
subject! { render }
|
|
|
|
|
|
2018-08-14 15:02:39 +02:00
|
|
|
|
it 'renders a summary of the dossier state' do
|
2018-10-08 18:44:19 +02:00
|
|
|
|
expect(rendered).to have_text("Dossier nº #{dossier.id}")
|
2018-09-05 13:55:43 +02:00
|
|
|
|
expect(rendered).to have_selector('.status-overview')
|
2018-08-07 16:32:11 +02:00
|
|
|
|
end
|
2018-09-11 18:40:10 +02:00
|
|
|
|
|
|
|
|
|
context 'with messages' do
|
|
|
|
|
let(:first_message) { create(:commentaire, body: 'Premier message') }
|
|
|
|
|
let(:last_message) { create(:commentaire, body: 'Second message') }
|
|
|
|
|
let(:dossier) { create(:dossier, :en_construction, commentaires: [first_message, last_message]) }
|
|
|
|
|
|
|
|
|
|
it 'displays the last message' do
|
|
|
|
|
expect(rendered).not_to have_text(first_message.body)
|
|
|
|
|
expect(rendered).to have_text(last_message.body)
|
|
|
|
|
end
|
|
|
|
|
end
|
2018-08-07 16:32:11 +02:00
|
|
|
|
end
|