demarches-normaliennes/spec/views/users/sessions/new.html.haml_spec.rb
2017-04-04 16:59:38 +02:00

34 lines
971 B
Ruby

require 'spec_helper'
describe 'users/sessions/new.html.haml', type: :view do
let(:dossier) { create :dossier }
before(:each) do
allow(view).to receive(:devise_mapping).and_return(Devise.mappings[:user])
allow(view).to receive(:resource_name).and_return(:user)
end
before do
assign(:user, User.new)
end
context 'when user_return_to session params contains a procedure_id' do
before do
assign(:dossier, dossier)
render
end
it { expect(rendered).to have_selector('#form_login #logo_procedure') }
it { expect(rendered).to have_selector('#form_login #titre_procedure') }
it { expect(rendered).to have_content(dossier.procedure.libelle) }
it { expect(rendered).to have_content(dossier.procedure.description) }
end
context 'when user_return_to session params not contains a procedure_id' do
before do
render
end
it { expect(rendered).to have_selector('#form_login #logo_tps') }
end
end