demarches-normaliennes/spec/views/new_user/dossiers/show.html.haml_spec.rb
2018-12-03 16:28:18 +01:00

28 lines
864 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require 'spec_helper'
describe 'new_user/dossiers/show.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_construction) }
before do
sign_in dossier.user
assign(:dossier, dossier)
end
subject! { render }
it 'renders a summary of the dossier state' do
expect(rendered).to have_text("Dossier nº #{dossier.id}")
expect(rendered).to have_selector('.status-overview')
end
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
end