Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuuleh committed Nov 21, 2016
1 parent 06f2771 commit aa3d705
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/models/payment/braintree/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def publish_subscription_charge
ChampaignQueue.push({
type: 'subscription-payment',
params: {
recurring_id: self.subscription.try(:action).form_data['subscription_id'],
success: self.status == 'success' ? 1 : 0
recurring_id: subscription.try(:action).form_data['subscription_id'],
success: status == 'success' ? 1 : 0
}
}, { delay: 120 })
end
Expand Down
15 changes: 7 additions & 8 deletions spec/models/payment/braintree/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,19 @@
end

describe 'publish subscription payment' do
let(:action) { create(:action, form_data: {'subscription_id' => 'subscription_id'}) }
let(:action) { create(:action, form_data: { 'subscription_id' => 'subscription_id' }) }
let(:subscription) { create(:payment_braintree_subscription, subscription_id: 'subscription_id', action: action) }
let(:transaction) { create(:payment_braintree_transaction, subscription: subscription, status: 'success') }
it 'pushes a subscription payment event with a status to the queue' do
expected_payload = {
type: 'subscription-payment',
params: {
recurring_id: 'subscription_id',
success: 1
}
}
type: 'subscription-payment',
params: {
recurring_id: 'subscription_id',
success: 1
}
}
expect(ChampaignQueue).to receive(:push).with(expected_payload, delay: 120)
transaction.publish_subscription_charge
end

end
end
6 changes: 4 additions & 2 deletions spec/requests/api/braintree/webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
expected_payload = {
type: 'subscription-payment',
params: {
recurring_id: /[a-z0-9]{6}/
recurring_id: /[a-z0-9]{6}/,
success: 1
}
}

Expand Down Expand Up @@ -148,7 +149,8 @@
expected_payload = {
type: 'subscription-payment',
params: {
recurring_id: /[a-z0-9]{6}/
recurring_id: /[a-z0-9]{6}/,
success: 1
}
}

Expand Down

0 comments on commit aa3d705

Please sign in to comment.