stripe-ruby/test/stripe/api_operations_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

21 lines
581 B
Ruby

# -*- coding: utf-8 -*-
require File.expand_path('../../test_helper', __FILE__)
module Stripe
class ApiOperationsTest < Test::Unit::TestCase
class Updater < APIResource
include Stripe::APIOperations::Save
end
should "the Update API operation should post the correct parameters to the resource URL" do
@mock.expects(:post).once.
with("#{Stripe.api_base}/v1/updaters/id", nil, 'foo=bar').
returns(make_response({foo: 'bar'}))
resource = Updater::update("id", {foo: "bar"})
assert_equal('bar', resource.foo)
end
end
end