Merge pull request #1109 from sgmap/improve_attestation_template_spec

Cosmetic(ish): in spec, save changes to model
This commit is contained in:
gregoirenovel 2017-12-15 16:45:50 +01:00 committed by GitHub
commit a1426ec56d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -209,16 +209,16 @@ describe AttestationTemplate, type: :model do
end
context 'and their value in the dossier are not nil' do
before :each do
before do
dossier.champs
.select { |champ| champ.libelle == 'libelleA' }
.first
.value = 'libelle1'
.update_attributes(value: 'libelle1')
dossier.champs
.select { |champ| champ.libelle == 'libelleB' }
.first
.value = 'libelle2'
.update_attributes(value: 'libelle2')
end
it { expect(view_args[:title]).to eq('title libelle1') }
@ -245,12 +245,7 @@ describe AttestationTemplate, type: :model do
let(:template_title) { 'title --libelleA--' }
context 'and its value in the dossier are not nil' do
before :each do
dossier.champs_private
.select { |champ| champ.libelle == 'libelleA' }
.first
.value = 'libelle1'
end
before { dossier.champs_private.first.update_attributes(value: 'libelle1') }
it { expect(view_args[:title]).to eq('title libelle1') }
end
@ -267,16 +262,16 @@ describe AttestationTemplate, type: :model do
let(:template_title) { 'title --date-- --datetime--' }
context 'and its value in the dossier are not nil' do
before :each do
before do
dossier.champs
.select { |champ| champ.type_champ == 'date' }
.first
.value = '2017-04-15'
.update_attributes(value: '2017-04-15')
dossier.champs
.select { |champ| champ.type_champ == 'datetime' }
.first
.value = '13/09/2017 09:00'
.update_attributes(value: '13/09/2017 09:00')
end
it { expect(view_args[:title]).to eq('title 15/04/2017 13/09/2017 09:00') }
@ -285,11 +280,7 @@ describe AttestationTemplate, type: :model do
end
context "match breaking and non breaking spaces" do
before do
c = dossier.champs.first
c.value = 'valeur'
c.save
end
before { dossier.champs.first.update_attributes(value: 'valeur') }
context "when the tag contains a non breaking space" do
let(:template_body) { 'body --mon tag--' }