Skip to content

Commit

Permalink
Merge pull request #1664 from etalab/bugfix/public-id-datapass
Browse files Browse the repository at this point in the history
  • Loading branch information
skelz0r authored Sep 12, 2024
2 parents 9ad61bf + d4896ee commit 552208c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/controllers/api/datapass_webhooks_v2_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def datapass_webhook_params
:model_type,
:model_id,
:fired_at,
:public_id,
data: {}
).to_h.symbolize_keys
end
Expand Down
14 changes: 12 additions & 2 deletions spec/controllers/api/datapass_webhooks_v2_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
'event' => event,
'model_id' => 9001,
'model_type' => 'Pass',
'public_id' => public_id,
'fired_at' => Time.now.to_i.to_s,
'data' => {
'what' => 'ever'
}
}
end

let(:public_id) { SecureRandom.uuid }

describe '#api_entreprise' do
subject do
post :api_entreprise, params:
Expand Down Expand Up @@ -56,8 +59,15 @@
)
end

it 'calls DatapassWebhook::V2::APIEntreprise' do
expect(DatapassWebhook::V2::APIEntreprise).to receive(:call)
it 'calls DatapassWebhook::V2::APIEntreprise with public id and data)' do
expect(DatapassWebhook::V2::APIEntreprise).to receive(:call).with(
hash_including(
public_id:,
data: {
'what' => 'ever'
}
)
)

subject
end
Expand Down

0 comments on commit 552208c

Please sign in to comment.