Sha256: 811565eedb342f1780d0c14f3015b31cf2edeb3a7e9c06e5f56823be8db57be7

Contents?: true

Size: 931 Bytes

Versions: 2

Compression:

Stored size: 931 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

module Stripe
  class InvoiceTest < Test::Unit::TestCase
    should "retrieve should retrieve invoices" do
      @mock.expects(:get).once.returns(test_response(test_invoice))
      i = Stripe::Invoice.retrieve('in_test_invoice')
      assert_equal 'in_test_invoice', i.id
    end

    should "create should create a new invoice" do
      @mock.expects(:post).once.returns(test_response(test_invoice))
      i = Stripe::Invoice.create
      assert_equal "in_test_invoice", i.id
    end

    should "pay should pay an invoice" do
      @mock.expects(:get).once.returns(test_response(test_invoice))
      i = Stripe::Invoice.retrieve('in_test_invoice')

      @mock.expects(:post).once.with('https://api.stripe.com/v1/invoices/in_test_invoice/pay', nil, '').returns(test_response(test_paid_invoice))
      i.pay
      assert_equal i.next_payment_attempt, nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stripe-1.10.1 test/stripe/invoice_test.rb
stripe-1.10.0 test/stripe/invoice_test.rb