stripe-ruby/test/stripe/invoice_item_test.rb
Kyle Conroy 732a494ac4 Add update class method to API resources (#426)
* Rename the `Update` operation to `Save`
* Add the `update` class method to all saveable resources
* Add tests for update method
* Add tests for plans, invoice items, and application fees
2016-06-29 14:13:42 -07:00

20 lines
771 B
Ruby

require File.expand_path('../../test_helper', __FILE__)
module Stripe
class InvoiceItemTest < Test::Unit::TestCase
should "retrieve should retrieve invoice items" do
@mock.expects(:get).once.returns(make_response(make_invoice_item))
ii = Stripe::InvoiceItem.retrieve('in_test_invoice_item')
assert_equal 'ii_test_invoice_item', ii.id
end
should "invoice items should be updateable" do
@mock.expects(:post).once.
with('https://api.stripe.com/v1/invoiceitems/test_invoice_item', nil, 'metadata[foo]=bar').
returns(make_response(make_charge(metadata: {'foo' => 'bar'})))
ii = Stripe::InvoiceItem.update("test_invoice_item", metadata: {foo: 'bar'})
assert_equal('bar', ii.metadata['foo'])
end
end
end