Skip to content

Commit

Permalink
Track that costs are logged with a transaction ID
Browse files Browse the repository at this point in the history
  • Loading branch information
matthinz committed Oct 30, 2024
1 parent 0205d8f commit 9e310dc
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions spec/services/proofing/resolution/plugins/aamva_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
Proofing::StateIdResult.new(
success: true,
vendor_name: 'state_id:aamva',
transaction_id: proofer_transaction_id,
)
end
let(:proofer_transaction_id) { 'abcd-123' }

subject(:plugin) do
described_class.new
Expand All @@ -22,10 +24,18 @@
end

describe '#call' do
def sp_cost_count
def sp_cost_count_for_issuer
SpCost.where(cost_type: :aamva, issuer: current_sp.issuer).count
end

def sp_cost_count_with_transaction_id
SpCost.where(
cost_type: :aamva,
issuer: current_sp.issuer,
transaction_id: proofer_transaction_id,
).count
end

subject(:call) do
plugin.call(
applicant_pii:,
Expand Down Expand Up @@ -64,7 +74,7 @@ def sp_cost_count

it 'tracks an SP cost for AAMVA' do
expect { call }.to(
change { sp_cost_count }.
change { sp_cost_count_with_transaction_id }.
to(1),
)
end
Expand All @@ -79,7 +89,7 @@ def sp_cost_count
end

it 'does not track an SP cost for AAMVA' do
expect { call }.to_not change { sp_cost_count }
expect { call }.to_not change { sp_cost_count_for_issuer }
end
end
end
Expand All @@ -103,7 +113,7 @@ def sp_cost_count
it 'tracks an SP cost for AAMVA' do
expect { call }.
to(
change { sp_cost_count }.
change { sp_cost_count_with_transaction_id }.
to(1),
)
end
Expand All @@ -124,7 +134,7 @@ def sp_cost_count
end

it 'does not record an SP cost for AAMVA' do
expect { call }.not_to change { sp_cost_count }
expect { call }.not_to change { sp_cost_count_for_issuer }
end

it 'returns an UnsupportedJurisdiction result' do
Expand Down Expand Up @@ -168,7 +178,7 @@ def sp_cost_count
end

it 'records an SP cost for AAMVA' do
expect { call }.to change { sp_cost_count }.to(1)
expect { call }.to change { sp_cost_count_with_transaction_id }.to(1)
end
end

Expand All @@ -189,7 +199,7 @@ def sp_cost_count
end

it 'records an SP cost for AAMVA' do
expect { call }.to change { sp_cost_count }.to(1)
expect { call }.to change { sp_cost_count_with_transaction_id }.to(1)
end
end

Expand All @@ -208,7 +218,7 @@ def sp_cost_count
end

it 'does not record an SP cost for AAMVA' do
expect { call }.not_to change { sp_cost_count }
expect { call }.not_to change { sp_cost_count_for_issuer }
end

it 'returns an UnsupportedJurisdiction result' do
Expand Down Expand Up @@ -239,7 +249,7 @@ def sp_cost_count
end

it 'records an SP cost for AAMVA' do
expect { call }.to change { sp_cost_count }.to(1)
expect { call }.to change { sp_cost_count_with_transaction_id }.to(1)
end
end

Expand All @@ -260,7 +270,7 @@ def sp_cost_count
end

it 'does not record an SP cost for AAMVA' do
expect { call }.not_to change { sp_cost_count }
expect { call }.not_to change { sp_cost_count_for_issuer }
end
end

Expand All @@ -279,7 +289,7 @@ def sp_cost_count
end

it 'does not record an SP cost for AAMVA' do
expect { call }.not_to change { sp_cost_count }
expect { call }.not_to change { sp_cost_count_for_issuer }
end

it 'returns an UnsupportedJurisdiction result' do
Expand Down

0 comments on commit 9e310dc

Please sign in to comment.