Sha256: 3e006be2452a212bd82ce6ae80ff31394000825758c5e73ff6c023442c7fc773
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
require "spec_helper" include PayPal::Invoice describe PayPal::Invoice::Invoice do describe "#mark_as_paid" do context "when successful" do use_vcr_cassette "invoice/mark_as_paid/success"#, :record => :all let(:invoice) { PayPal::Invoice::Invoice.new( :merchant_email => 'chardy_1345003248_per@gmail.com', :payer_email => 'chardy_1345003165_per@gmail.com', :item_list => { :item => [ { :name => 'iPhone 5', :quantity => 1, :unit_price => 1000.0 } ] }, :currency_code => 'USD', :payment_terms => 'Net30' ) } before do invoice.create_and_send invoice.payment = OtherPaymentDetails.new({ :method => 'Cash', :date => Date.today }) end subject { invoice.mark_as_paid } its(:success?) { should be_true } its(:valid?) { should be_true } end context "when failure" do use_vcr_cassette "invoice/mark_as_paid/failure"#, :record => :all let(:invoice) { PayPal::Invoice::Invoice.new( :merchant_email => 'chardy_1345003248_per@gmail.com', :payer_email => 'chardy_1345003165_per@gmail.com', :item_list => { :item => [ { :name => 'iPhone 5', :quantity => 1, :unit_price => 1000.0 } ] }, :currency_code => 'USD', :payment_terms => 'Net30' ) } before do invoice.create invoice.payment = nil end subject { invoice.mark_as_paid } its(:success?) { should be_false } its(:valid?) { should be_false } its(:errors) { should_not be_empty } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paypal-payment-0.1.2 | spec/paypal/invoice/mark_as_paid_spec.rb |