Sha256: 7669596e3a147619832e595cbb13a4db38b66c27c85b31ad3f3438ff08e6ea09

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

module Workarea
  module Paypal
    class ApproveOrderTest < TestCase
      include PaypalSetup

      setup :checkout

      def test_perform
        order_id = VCR.use_cassette('paypal_create_order') do
          CreateOrder.new(checkout).perform.id
        end

        checkout.start_as(:guest)

        VCR.use_cassette('paypal_approve_order') do
          ApproveOrder.new(checkout, order_id).perform
        end

        assert(checkout.complete?)
        assert(checkout.order.email.present?)
        assert(checkout.shipping.shipping_service.valid?)
        assert(checkout.shipping.address.valid?)
        assert(checkout.payment.address.valid?)
        assert(checkout.payment.paypal?)
        assert(checkout.payment.paypal.paypal_id.present?)
        assert(checkout.payment.paypal.payer_id.present?)
        assert(checkout.payment.paypal.details.present?)
        assert(checkout.payment.paypal.approved?)
        assert_equal(checkout.order.total_price, checkout.payment.paypal.amount)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
workarea-paypal-3.0.6 test/services/workarea/paypal/approve_order_test.rb
workarea-paypal-3.0.5 test/services/workarea/paypal/approve_order_test.rb
workarea-paypal-3.0.4 test/services/workarea/paypal/approve_order_test.rb
workarea-paypal-3.0.3 test/services/workarea/paypal/approve_order_test.rb
workarea-paypal-3.0.2 test/services/workarea/paypal/approve_order_test.rb
workarea-paypal-3.0.1 test/services/workarea/paypal/approve_order_test.rb
workarea-paypal-3.0.0 test/services/workarea/paypal/approve_order_test.rb