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

49 lines
1.4 KiB
Ruby
Raw Normal View History

2015-12-10 16:09:21 +01:00
require 'spec_helper'
describe 'users/dossiers/new.html.haml', type: :view, vcr: { cassette_name: 'user_dossier_new_html' } do
2015-12-10 16:09:21 +01:00
let(:user) { create(:user) }
let(:euro_flag) { false }
2016-02-02 18:37:38 +01:00
let(:cerfa_flag) { false }
let(:logo) { '' }
2016-02-02 18:37:38 +01:00
let(:procedure) { create(:procedure, euro_flag: euro_flag, cerfa_flag: cerfa_flag, logo: logo) }
let!(:dossier) { create(:dossier, procedure: procedure, user: user).decorate }
2015-12-10 16:09:21 +01:00
before do
sign_in user
2015-12-10 16:09:21 +01:00
assign(:dossier, dossier.decorate)
render
end
2015-12-10 16:09:21 +01:00
subject { rendered }
2015-12-10 16:09:21 +01:00
it { is_expected.to have_css('#users_siret_index') }
2015-12-10 16:09:21 +01:00
describe 'euro flag' do
2015-12-10 16:09:21 +01:00
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
2016-02-04 14:08:35 +01:00
it 'TPS logo is present' do
2016-03-02 10:31:43 +01:00
is_expected.to match(/src="\/assets\/logo-tps-.*\.png"/)
end
end
context 'procedure have logo' do
2015-12-11 10:36:16 +01:00
# 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
2015-12-10 16:09:21 +01:00
end