diff --git a/app/clients/formulaire_qf_api_client.rb b/app/clients/formulaire_qf_api_client.rb index a9ac73c1b..45cf86a64 100644 --- a/app/clients/formulaire_qf_api_client.rb +++ b/app/clients/formulaire_qf_api_client.rb @@ -1,3 +1,4 @@ +# :nocov: class FormulaireQFAPIClient def create_collectivity(organization:, editor_id: nil) params = { diff --git a/app/clients/hubee_api_authentication.rb b/app/clients/hubee_api_authentication.rb index 76db47095..e7e0a6819 100644 --- a/app/clients/hubee_api_authentication.rb +++ b/app/clients/hubee_api_authentication.rb @@ -1,3 +1,4 @@ +# :nocov: class HubEEAPIAuthentication < AbstractHubEEAPIClient def access_token http_connection.post( diff --git a/app/clients/hubee_api_client.rb b/app/clients/hubee_api_client.rb index 65ce750ac..0dae09283 100644 --- a/app/clients/hubee_api_client.rb +++ b/app/clients/hubee_api_client.rb @@ -1,3 +1,4 @@ +# :nocov: class HubEEAPIClient < AbstractHubEEAPIClient # rubocop:disable Metrics/ClassLength class NotFound < StandardError; end class AlreadyExists < StandardError; end diff --git a/spec/jobs/create_formulaire_qf_resources_job_spec.rb b/spec/jobs/create_formulaire_qf_resources_job_spec.rb new file mode 100644 index 000000000..983cbaebd --- /dev/null +++ b/spec/jobs/create_formulaire_qf_resources_job_spec.rb @@ -0,0 +1,22 @@ +require 'rails_helper' + +RSpec.describe CreateFormulaireQFResourcesJob do + describe '#perform' do + subject do + described_class.perform_now(authorization_request_id) + end + + let(:authorization_request) { create(:authorization_request, :with_demandeur, :with_contact_technique) } + let(:authorization_request_id) { authorization_request.id } + + before do + allow(DatapassWebhook::CreateFormulaireQFResources).to receive(:call).with(authorization_request:) + end + + it 'creates FormulaireQF resources' do + subject + + expect(DatapassWebhook::CreateFormulaireQFResources).to have_received(:call).with(authorization_request:) + end + end +end