Correct bugs in how payment notification jobs are enqueued
This commit is contained in:
parent
b77a59ba24
commit
d544242ae7
1 changed files with 21 additions and 12 deletions
|
@ -327,13 +327,8 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
|
|
||||||
def before_each_success(expect_charge = true)
|
def before_each_success(expect_charge = true)
|
||||||
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
||||||
expect {
|
|
||||||
expect {
|
|
||||||
result = m.call(*args)
|
result = m.call(*args)
|
||||||
}.to have_enqueued_job(PaymentNotificationJob).with(result, supporter.local)
|
|
||||||
}.to have_enqueued_job(WeMoveExecuteForDonationsJob)
|
|
||||||
@donation_id = result.id
|
@donation_id = result.id
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -370,13 +365,8 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_each_sepa_success
|
def before_each_sepa_success
|
||||||
|
|
||||||
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
||||||
expect {
|
|
||||||
expect {
|
|
||||||
result = m.call(*args)
|
result = m.call(*args)
|
||||||
}.to have_enqueued_job(DirectDebitCreateJob).with(result.id, supporter.local)
|
|
||||||
}.to have_enqueued_job(WeMoveExecuteForDonationsJob)
|
|
||||||
@donation_id = result.id
|
@donation_id = result.id
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
@ -395,6 +385,12 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
if data[:recurring_donation]
|
if data[:recurring_donation]
|
||||||
expect(result['recurring_donation'].attributes).to eq expected[:recurring_donation]
|
expect(result['recurring_donation'].attributes).to eq expected[:recurring_donation]
|
||||||
end
|
end
|
||||||
|
if (data[:sepa])
|
||||||
|
expect(DirectDebitCreateJob).to have_been_enqueued.with(result['donation']['id'], supporter.locale)
|
||||||
|
else
|
||||||
|
expect(PaymentNotificationJob).to have_been_enqueued.with(result['donation'], supporter.locale)
|
||||||
|
end
|
||||||
|
expect(WeMoveExecuteForDonationsJob).to have_been_enqueued
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
@ -412,6 +408,12 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
if data[:recurring_donation]
|
if data[:recurring_donation]
|
||||||
expect(result['recurring_donation'].attributes).to eq expected[:recurring_donation]
|
expect(result['recurring_donation'].attributes).to eq expected[:recurring_donation]
|
||||||
end
|
end
|
||||||
|
if (data[:sepa])
|
||||||
|
|
||||||
|
else
|
||||||
|
expect(PaymentNotificationJob).to have_been_enqueued.with(result['donation'], supporter.locale)
|
||||||
|
end
|
||||||
|
expect(WeMoveExecuteForDonationsJob).to have_been_enqueued
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -436,6 +438,13 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
if data[:recurring_donation]
|
if data[:recurring_donation]
|
||||||
expect(result['recurring_donation'].attributes).to eq expected[:recurring_donation]
|
expect(result['recurring_donation'].attributes).to eq expected[:recurring_donation]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (data[:sepa])
|
||||||
|
|
||||||
|
else
|
||||||
|
expect(PaymentNotificationJob).to have_been_enqueued.with(result['donation'], supporter.locale)
|
||||||
|
end
|
||||||
|
expect(WeMoveExecuteForDonationsJob).to have_been_enqueued
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue