to_params -> to_array
This commit is contained in:
parent
3e16eff9a0
commit
182afee970
3 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ class ApiEntreprise::ExercicesAdapter
|
|||
@procedure_id = procedure_id
|
||||
end
|
||||
|
||||
def to_params
|
||||
def to_array
|
||||
data_source[:exercices].map do |exercice|
|
||||
exercice.slice(*attr_to_fetch)
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class SIRETService
|
|||
params = etablissement.to_params
|
||||
.merge(entreprise.to_params.map { |k,v| ["entreprise_#{k}", v] }.to_h)
|
||||
.merge(association.to_params&.map { |k,v| ["association_#{k}", v] }.to_h)
|
||||
.merge(exercices_attributes: exercices.to_params)
|
||||
.merge(exercices_attributes: exercices.to_array)
|
||||
|
||||
# This is to fill legacy models and relationships
|
||||
if dossier.present?
|
||||
|
|
|
@ -3,14 +3,14 @@ require 'spec_helper'
|
|||
describe ApiEntreprise::ExercicesAdapter do
|
||||
let(:siret) { '41816609600051' }
|
||||
let(:procedure_id) { 11 }
|
||||
subject { described_class.new(siret, procedure_id).to_params }
|
||||
subject { described_class.new(siret, procedure_id).to_array }
|
||||
|
||||
before do
|
||||
stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
|
||||
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
|
||||
end
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
it '#to_array class est un Array ?' do
|
||||
expect(subject).to be_an_instance_of(Array)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue