demarches-normaliennes/spec/views/users/dossiers/new_html.haml_spec.rb

48 lines
No EOL
1.3 KiB
Ruby

require 'spec_helper'
describe 'users/dossiers/new.html.haml', type: :view do
let(:user) { create(:user) }
let(:euro_flag) { false }
let(:logo) { '' }
let(:procedure) { create(:procedure, euro_flag: euro_flag, logo: logo) }
let!(:dossier) { create(:dossier, procedure: procedure, user: user).decorate }
before do
sign_in user
assign(:dossier, dossier.decorate)
render
end
subject { rendered }
it { is_expected.to have_css('#users_siret_index') }
describe 'euro flag' do
context 'euro flag is not present' do
it { is_expected.not_to have_css('#euro_flag.flag') }
end
context 'euro flag is present' do
let(:euro_flag) { true }
it { is_expected.to have_css('#euro_flag.flag') }
end
end
describe 'logo procedure' do
context 'procedure have no logo' do
it 'MPS logo is present' do
is_expected.to have_css("img[src='/assets#{asset_path('logo-tps.png')}']")
end
end
context 'procedure have logo' do
# let(:logo) { fixture_file_upload('spec/support/files/logo_test_procedure.png', 'image/png') }
let(:logo) { File.new(File.join(::Rails.root.to_s, "/spec/support/files", "logo_test_procedure.png")) }
it 'Procedure logo is present' do
is_expected.to have_css("img[src='#{procedure.logo}']")
end
end
end
end