source service supports unknown scope

This commit is contained in:
simon lehericey 2021-09-28 15:12:10 +02:00
parent ac60d6c5a1
commit 35c7f05a0a
2 changed files with 7 additions and 0 deletions

View file

@ -8,6 +8,7 @@ module APIParticulier
def available_sources
@procedure.api_particulier_scopes
.map { |provider_and_scope| raw_scopes[provider_and_scope] }
.compact
.map { |provider, scope| extract_sources(provider, scope) }
.reduce({}) { |acc, el| acc.deep_merge(el) }
end

View file

@ -31,6 +31,12 @@ describe APIParticulier::Services::SourcesService do
it { is_expected.to match(cnaf_allocataires_and_enfants) }
end
context 'when a procedure has an unknown scope' do
let(:api_particulier_scopes) { ['unknown_scope'] }
it { is_expected.to match({}) }
end
end
describe '#sanitize' do