diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 4db38b186..5d0601985 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -26,6 +26,12 @@ describe Dossier do it { is_expected.to have_one(:entreprise) } end + describe "delegation" do + it { is_expected.to delegate_method(:siren).to(:entreprise) } + it { is_expected.to delegate_method(:siret).to(:etablissement) } + it { is_expected.to delegate_method(:types_piece_jointe).to(:formulaire) } + end + let(:dossier) { create(:dossier, :with_entreprise) } let(:entreprise) { dossier.entreprise } @@ -33,18 +39,6 @@ describe Dossier do subject { dossier } - describe '#siren' do - it 'returns entreprise siren' do - expect(subject.siren).to eq(entreprise.siren) - end - end - - describe '#siret' do - it 'returns etablissement siret' do - expect(subject.siret).to eq(etablissement.siret) - end - end - describe '#types_piece_jointe' do subject { dossier.types_piece_jointe } it 'returns list of required piece justificative' do