2015-09-24 10:17:59 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'dossiers/_infos_dossier.html.haml', type: :view do
|
2016-01-18 17:18:04 +01:00
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, procedure: create(:procedure, :with_api_carto, :with_type_de_champ)) }
|
2015-09-24 10:17:59 +02:00
|
|
|
|
|
|
|
before do
|
2016-02-25 11:50:09 +01:00
|
|
|
champs.each do |champ|
|
|
|
|
champ.value = ((0...8).map { (65 + rand(26)).chr }.join)
|
|
|
|
champ.save
|
|
|
|
end
|
|
|
|
|
2015-12-24 15:10:20 +01:00
|
|
|
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
|
2015-09-24 10:17:59 +02:00
|
|
|
render
|
|
|
|
end
|
2015-11-04 11:14:07 +01:00
|
|
|
|
|
|
|
describe 'every champs are present on the page' do
|
|
|
|
let(:champs) { dossier.champs }
|
|
|
|
|
|
|
|
it { expect(rendered).to have_content(champs.first.libelle) }
|
|
|
|
it { expect(rendered).to have_content(champs.first.value) }
|
|
|
|
|
|
|
|
it { expect(rendered).to have_content(champs.last.libelle) }
|
|
|
|
it { expect(rendered).to have_content(champs.last.value) }
|
2015-11-19 17:20:22 +01:00
|
|
|
|
|
|
|
context 'when api carto is used' do
|
|
|
|
it { expect(rendered).to have_css('#map') }
|
|
|
|
end
|
2015-11-04 11:14:07 +01:00
|
|
|
end
|
2015-09-24 10:17:59 +02:00
|
|
|
end
|