2023-09-06 17:16:02 +02:00
|
|
|
describe ChorusConfiguration do
|
|
|
|
context 'empty' do
|
2023-10-13 13:16:22 +02:00
|
|
|
subject { create(:procedure, :empty_chorus) }
|
2023-09-06 17:16:02 +02:00
|
|
|
it { is_expected.to be_valid }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'partially filled chorus_configuration' do
|
2023-10-13 13:16:22 +02:00
|
|
|
subject { create(:procedure, :partial_chorus) }
|
2023-09-06 17:16:02 +02:00
|
|
|
it { is_expected.to be_valid }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'fully filled chorus_configuration' do
|
2023-10-13 13:16:22 +02:00
|
|
|
subject { create(:procedure, :filled_chorus) }
|
2023-09-06 17:16:02 +02:00
|
|
|
it { is_expected.to be_valid }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'ChorusConfiguration' do
|
|
|
|
it 'works without args' do
|
|
|
|
expect { ChorusConfiguration.new }.not_to raise_error
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'works with args' do
|
|
|
|
expect { ChorusConfiguration.new({}) }.not_to raise_error
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'works with existing args' do
|
|
|
|
expect do
|
|
|
|
cc = ChorusConfiguration.new()
|
2023-11-09 09:59:04 +01:00
|
|
|
cc.assign_attributes(centre_de_cout: {}, domaine_fonctionnel: {}, referentiel_de_programmation: {})
|
2023-09-06 17:16:02 +02:00
|
|
|
end.not_to raise_error
|
|
|
|
end
|
|
|
|
end
|
2023-10-13 13:16:22 +02:00
|
|
|
|
|
|
|
describe '#complete?' do
|
|
|
|
subject { procedure.chorus_configuration.complete? }
|
|
|
|
|
|
|
|
context 'without data' do
|
|
|
|
let(:procedure) { create(:procedure, :empty_chorus) }
|
|
|
|
it { is_expected.to be_falsey }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with partial data' do
|
|
|
|
let(:procedure) { create(:procedure, :partial_chorus) }
|
|
|
|
it { is_expected.to be_falsey }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with all data' do
|
|
|
|
let(:procedure) { create(:procedure, :filled_chorus) }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
end
|
2023-09-06 17:16:02 +02:00
|
|
|
end
|