Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataPass webhooks: update authorization requests on tranfer #1663

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def reopening_event?
end

def should_update_authorization_request?
!context.reopening || (context.reopening && %w[approve validate].include?(context.event))
!context.reopening || (context.reopening && %w[transfer approve validate].include?(context.event))
end

def create_or_update_contacts_with_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
create(:authorization_request, :with_all_contacts, status: 'validated', external_id: authorization_id)
end

context 'when event is not approve or validate' do
context 'when event is not approve, validate or transfer' do
let!(:event) { 'draft' }

it { is_expected.to be_a_success }
Expand All @@ -108,7 +108,7 @@
end
end

context 'when event is approve or validate' do
context 'when event is validate' do
let!(:event) { 'validate' }

it { is_expected.to be_a_success }
Expand All @@ -119,6 +119,18 @@
}.to change { authorization_request.reload.last_update.to_i }
end
end

context 'when event is transfer' do
let!(:event) { 'transfer' }

it { is_expected.to be_a_success }

it 'updates the authorization request' do
expect {
subject
}.to change { authorization_request.reload.last_update.to_i }
end
end
end
end

Expand Down
Loading