Sha256: 488391295091a86a322196b608a577c4adf6a8fcad164086961d592aa856424d
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe Spree::PaymentMethod::Bitpay do describe '#scan_the_server' do subject = FactoryGirl.create(:bitcoin_payment_method) context 'when the invoice does not exist' do it "returns 'invoice not found'" do expect_any_instance_of(BitPay::Client).to receive(:get).and_return( { "error"=> { "type"=>"notFound", "message"=>"Invoice not found"} } ) expect(subject.scan_the_server("5")).to eq("Invoice not found") end end context 'when the invoice has expired or paid' do it "returns 'expired' for expired invoices" do expect_any_instance_of(BitPay::Client).to receive(:get).and_return(get_fixture("valid_expired_invoice.json")) expect(subject.scan_the_server("5")).to eq("expired") end it "returns 'paid' for paid invoices" do expect_any_instance_of(BitPay::Client).to receive(:get).and_return(get_fixture("valid_paid_invoice.json")) expect(subject.scan_the_server("5")).to eq("paid") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_bitpay-1.0.2 | spec/models/spree/payment_method/bitpay.rb |