Merge branch 'develop' into auto_archive_on_date

This commit is contained in:
Mathieu Magnin 2017-03-22 11:32:56 +01:00 committed by GitHub
commit c2a27c6f6a
36 changed files with 248 additions and 149 deletions

View file

@ -1,15 +1,25 @@
require 'spec_helper'
describe DropDownList do
describe 'database columns' do
it { is_expected.to have_db_column(:value) }
end
describe 'associations' do
it { is_expected.to belong_to(:type_de_champ) }
end
let(:dropdownlist) { create :drop_down_list, value: value }
describe '#options' do
let(:value) { "Cohésion sociale
Dév.Eco / Emploi
Cadre de vie / Urb.
Pilotage / Ingénierie
" }
let(:dropdownlist) { create :drop_down_list, value: value }
it { expect(dropdownlist.options).to eq ["Cohésion sociale", "Dév.Eco / Emploi", "Cadre de vie / Urb.", "Pilotage / Ingénierie"] }
it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Dév.Eco / Emploi', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] }
context 'when one value is empty' do
let(:value) { "Cohésion sociale
@ -18,7 +28,36 @@ Cadre de vie / Urb.
Pilotage / Ingénierie
" }
it { expect(dropdownlist.options).to eq ["Cohésion sociale", "Cadre de vie / Urb.", "Pilotage / Ingénierie"] }
it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] }
end
end
describe 'disabled_options' do
let(:value) { "tip
--top--
--troupt--
ouaich" }
it { expect(dropdownlist.disabled_options).to match(['--top--', '--troupt--']) }
end
describe 'selected_options' do
let(:dropdownlist) do
create(:drop_down_list, type_de_champ: type_de_champ)
end
context 'when multiple' do
let(:type_de_champ) { TypeDeChamp.new(type_champ: 'multiple_drop_down_list') }
let(:champ) { Champ.new(value: '["1","2"]').decorate }
it { expect(dropdownlist.selected_options(champ)).to match(['1', '2']) }
end
context 'when simple' do
let(:type_de_champ) { TypeDeChamp.new(type_champ: 'drop_down_list') }
let(:champ) { Champ.new(value: '1').decorate }
it { expect(dropdownlist.selected_options(champ)).to match(['1']) }
end
end
end

View file

@ -183,10 +183,6 @@ describe Procedure do
expect(subject.received_mail.id).not_to be nil
expect(subject.received_mail.procedure_id).not_to eq procedure.received_mail.procedure_id
expect(subject.received_mail.procedure_id).not_to be nil
expect(subject.received_mail.created_at).not_to eq procedure.received_mail.created_at
expect(subject.received_mail.created_at).not_to be nil
expect(subject.received_mail.updated_at).not_to eq procedure.received_mail.updated_at
expect(subject.received_mail.updated_at).not_to be nil
end
it 'should not duplicate default mail_template' do