demarches-normaliennes/spec/lib/api_entreprise/exercices_adapter_spec.rb

23 lines
872 B
Ruby
Raw Normal View History

2018-03-15 16:56:21 +01:00
describe ApiEntreprise::ExercicesAdapter do
let(:siret) { '41816609600051' }
let(:procedure_id) { 11 }
subject { described_class.new(siret, procedure_id).to_params }
before do
2018-05-09 12:03:04 +02:00
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
.to_return(body: File.read('spec/fixtures/files/api_entreprise/exercices.json', status: 200))
end
2019-04-30 16:18:56 +02:00
it { is_expected.to be_an_instance_of(Hash) }
2019-04-30 16:18:56 +02:00
it 'contains several exercices attributes' do
expect(subject[:exercices_attributes].size).to eq(3)
end
2019-04-30 16:18:56 +02:00
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)
end
2017-04-04 15:27:04 +02:00
end