add tva adapter and tva job
This commit is contained in:
parent
f04e121a6f
commit
76a8b721ce
8 changed files with 83 additions and 2 deletions
26
spec/lib/api_entreprise/tva_adapter_spec.rb
Normal file
26
spec/lib/api_entreprise/tva_adapter_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
describe APIEntreprise::TvaAdapter do
|
||||
let(:siren) { '418166096' }
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:procedure_id) { procedure.id }
|
||||
let(:adapter) { described_class.new(siren, procedure_id) }
|
||||
subject { adapter.to_params }
|
||||
|
||||
before do
|
||||
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v3\/european_commission\/unites_legales\/#{siren}\/numero_tva/)
|
||||
.to_return(body: body, status: status)
|
||||
allow_any_instance_of(APIEntrepriseToken).to receive(:expired?).and_return(false)
|
||||
end
|
||||
|
||||
context "when the SIRET is valid" do
|
||||
let(:body) { File.read('spec/fixtures/files/api_entreprise/tva.json') }
|
||||
let(:status) { 200 }
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
expect(subject).to be_an_instance_of(Hash)
|
||||
end
|
||||
|
||||
it 'L\'entreprise contient bien un numero_tva_intracommunautaire' do
|
||||
expect(subject[:entreprise_numero_tva_intracommunautaire]).to eq("FR48672039971")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue