migrate exercices adapter
This commit is contained in:
parent
0051face93
commit
0e85f84eff
6 changed files with 45 additions and 37 deletions
|
@ -115,7 +115,7 @@ describe APIEntreprise::API do
|
|||
|
||||
describe '.exercices' do
|
||||
before do
|
||||
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\//)
|
||||
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v3\/dgfip\/etablissements\/#{siret}\/chiffres_affaires/)
|
||||
.to_return(status: status, body: body)
|
||||
allow_any_instance_of(APIEntrepriseToken).to receive(:expired?).and_return(false)
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ describe APIEntreprise::ExercicesAdapter do
|
|||
subject { described_class.new(siret, procedure.id).to_params }
|
||||
|
||||
before do
|
||||
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\//)
|
||||
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v3\/dgfip\/etablissements\/#{siret}\/chiffres_affaires/)
|
||||
.to_return(body: File.read('spec/fixtures/files/api_entreprise/exercices.json', status: 200))
|
||||
allow_any_instance_of(APIEntrepriseToken).to receive(:expired?).and_return(false)
|
||||
end
|
||||
|
@ -12,12 +12,11 @@ describe APIEntreprise::ExercicesAdapter do
|
|||
it { is_expected.to be_an_instance_of(Hash) }
|
||||
|
||||
it 'contains several exercices attributes' do
|
||||
expect(subject[:exercices_attributes].size).to eq(3)
|
||||
expect(subject[:exercices_attributes].size).to eq(2)
|
||||
end
|
||||
|
||||
it 'contains informations in each exercices_attributes' do
|
||||
expect(subject[:exercices_attributes][0][:ca]).to eq('21009417')
|
||||
expect(subject[:exercices_attributes][0][:date_fin_exercice]).to eq("2013-12-31T00:00:00+01:00")
|
||||
expect(subject[:exercices_attributes][0][:date_fin_exercice_timestamp]).to eq(1388444400)
|
||||
expect(subject[:exercices_attributes][0][:ca]).to eq('900001')
|
||||
expect(subject[:exercices_attributes][0][:date_fin_exercice].year).to eq(2015)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue