mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
add unit spec for Payments query
This commit is contained in:
31
spec/queries/payments_requiring_action_spec.rb
Normal file
31
spec/queries/payments_requiring_action_spec.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe PaymentsRequiringAction do
|
||||
let(:user) { create(:user) }
|
||||
let(:order) { create(:order, user: user) }
|
||||
let(:payments_requiring_action) { described_class.new(user) }
|
||||
|
||||
describe '#query' do
|
||||
context "payment has a cvv_response_message" do
|
||||
let(:payment) do
|
||||
create(:payment, order: order, cvv_response_message: "https://stripe.com/redirect")
|
||||
end
|
||||
|
||||
it "finds the payment" do
|
||||
expect(payments_requiring_action.query.all).to include(payment)
|
||||
end
|
||||
end
|
||||
|
||||
context "payment has no cvv_response_message" do
|
||||
let(:payment) do
|
||||
create(:payment, order: order, cvv_response_message: nil)
|
||||
end
|
||||
|
||||
it "does not find the payment" do
|
||||
expect(payments_requiring_action.query.all).to_not include(payment)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user