2015-08-10 11:05:06 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-03-15 16:56:21 +01:00
|
|
|
describe ApiEntreprise::EntrepriseAdapter do
|
2018-02-21 16:29:22 +01:00
|
|
|
let(:siren) { '418166096' }
|
2018-03-15 12:02:45 +01:00
|
|
|
let(:procedure_id) { 22 }
|
|
|
|
let(:adapter) { described_class.new(siren, procedure_id) }
|
2018-02-21 16:29:22 +01:00
|
|
|
subject { adapter.to_params }
|
2015-08-10 11:05:06 +02:00
|
|
|
|
|
|
|
before do
|
2018-05-09 12:03:04 +02:00
|
|
|
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
|
2018-01-15 19:34:08 +01:00
|
|
|
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it '#to_params class est une Hash ?' do
|
2015-08-20 16:26:07 +02:00
|
|
|
expect(subject).to be_an_instance_of(Hash)
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'Attributs Entreprises' do
|
|
|
|
it 'L\'entreprise contient bien un siren' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_siren]).to eq(siren)
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un capital_social' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_capital_social]).to eq(462308)
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un numero_tva_intracommunautaire' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_numero_tva_intracommunautaire]).to eq('FR16418166096')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien une forme_juridique' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_forme_juridique]).to eq('SA à directoire (s.a.i.)')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un forme_juridique_code' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_forme_juridique_code]).to eq('5699')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un nom_commercial' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_nom_commercial]).to eq('OCTO-TECHNOLOGY')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien une raison_sociale' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_raison_sociale]).to eq('OCTO-TECHNOLOGY')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un siret_siege_social' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_siret_siege_social]).to eq('41816609600051')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un code_effectif_entreprise' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_code_effectif_entreprise]).to eq('31')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien une date_creation' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_date_creation]).to eq('Wed, 01 Apr 1998 00:00:00.000000000 +0200')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un nom' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_nom]).to eq('test_nom')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'L\'entreprise contient bien un prenom' do
|
2018-03-19 15:41:20 +01:00
|
|
|
expect(subject[:entreprise_prenom]).to eq('test_prenom')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
2016-01-19 17:19:38 +01:00
|
|
|
end
|
2015-08-20 17:30:17 +02:00
|
|
|
end
|