Sha256: 4ce6a817f227c53460d49473e8acfda37fb9292004e442c504f7f4243a900c36
Contents?: true
Size: 1.65 KB
Versions: 4
Compression:
Stored size: 1.65 KB
Contents
require 'test_helper' module Razorpay # Tests for Razorpay::Invoice class RazorpayInvoiceTest < Minitest::Test def setup @invoice_id = 'inv_6vRZmJYFAG1mNq' # Any request that ends with invoices/invoice_id stub_get(%r{invoices/#{@invoice_id}$}, 'fake_invoice') end def test_invoice_should_be_defined refute_nil Razorpay::Invoice end def test_invoice_should_be_created stub_post(/invoices$/, 'fake_invoice', 'customer_id=cust_6vRXClWqnLhV14&'\ 'amount=100¤cy=INR&description=Test%20description&type=link') invoice = Razorpay::Invoice.create customer_id: 'cust_6vRXClWqnLhV14', amount: 100, currency: 'INR', description: 'Test description', type: 'link' assert_equal 'cust_6vRXClWqnLhV14', invoice.customer_id assert_equal 100, invoice.amount assert_equal 'INR', invoice.currency assert_equal 'Test description', invoice.description assert_equal 'link', invoice.type end def test_invoices_should_be_fetched invoice = Razorpay::Invoice.fetch(@invoice_id) assert_instance_of Razorpay::Invoice, invoice, 'invoice not an instance of Razorpay::Invoice class' assert_equal @invoice_id, invoice.id, 'invoice IDs do not match' end def test_fetching_all_invoices stub_get(/invoices$/, 'invoice_collection') invoices = Razorpay::Invoice.all assert_instance_of Razorpay::Collection, invoices, 'Invoices should be an array' assert !invoices.items.empty?, 'invoices should be more than one' end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
razorpay-2.1.0 | test/razorpay/test_invoice.rb |
razorpay-2.1.0.pre | test/razorpay/test_invoice.rb |
razorpay-2.0.1 | test/razorpay/test_invoice.rb |
razorpay-2.0.0 | test/razorpay/test_invoice.rb |