2015-11-16 11:23:29 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe SIADE::ExercicesAdapter do
|
|
|
|
let(:siret) { '41816609600051' }
|
|
|
|
subject { described_class.new(siret).to_params }
|
|
|
|
|
|
|
|
before do
|
2017-12-11 15:31:45 +01:00
|
|
|
stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
|
2015-11-16 11:23:29 +01:00
|
|
|
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
|
|
|
|
end
|
|
|
|
|
|
|
|
it '#to_params class est une Hash ?' do
|
2016-01-20 10:34:22 +01:00
|
|
|
expect(subject).to be_an_instance_of(Array)
|
2015-11-16 11:23:29 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'have 3 exercices' do
|
|
|
|
expect(subject.size).to eq(3)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Attributs Exercices' do
|
|
|
|
it 'L\'exercice contient bien un ca' do
|
|
|
|
expect(subject[0][:ca]).to eq('21009417')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'exercice contient bien une date de fin d\'exercice' do
|
|
|
|
expect(subject[0][:dateFinExercice]).to eq("2013-12-31T00:00:00+01:00")
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'exercice contient bien une date_fin_exercice_timestamp' do
|
|
|
|
expect(subject[0][:date_fin_exercice_timestamp]).to eq(1388444400)
|
|
|
|
end
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|