mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-01 00:00:30 -04:00
Follows the path established in 2d75c8f by porting the rest of stripe-ruby's tests over to OpenAPI. There are a few other changes here where I've removed some tests that are duplicated or don't make much sense, or reorganized how we test certain things, but this commit is largely the same migration operation applied in bulk a few dozen test suites.
47 lines
1.4 KiB
Ruby
47 lines
1.4 KiB
Ruby
require File.expand_path('../../test_helper', __FILE__)
|
|
|
|
module Stripe
|
|
class PlanTest < Test::Unit::TestCase
|
|
FIXTURE = API_FIXTURES.fetch(:plan)
|
|
|
|
should "be listable" do
|
|
plans = Stripe::Plan.list
|
|
assert_requested :get, "#{Stripe.api_base}/v1/plans"
|
|
assert plans.data.kind_of?(Array)
|
|
assert plans.data[0].kind_of?(Stripe::Plan)
|
|
end
|
|
|
|
should "be retrievable" do
|
|
plan = Stripe::Plan.retrieve(FIXTURE[:id])
|
|
assert_requested :get, "#{Stripe.api_base}/v1/plans/#{FIXTURE[:id]}"
|
|
assert plan.kind_of?(Stripe::Plan)
|
|
end
|
|
|
|
should "be creatable" do
|
|
plan = Stripe::Plan.create(:metadata => {})
|
|
assert_requested :post, "#{Stripe.api_base}/v1/plans"
|
|
assert plan.kind_of?(Stripe::Plan)
|
|
end
|
|
|
|
should "be saveable" do
|
|
plan = Stripe::Plan.retrieve(FIXTURE[:id])
|
|
plan.metadata['key'] = 'value'
|
|
plan.save
|
|
assert_requested :post, "#{Stripe.api_base}/v1/plans/#{FIXTURE[:id]}"
|
|
end
|
|
|
|
should "be updateable" do
|
|
plan = Stripe::Plan.update(FIXTURE[:id], metadata: {foo: 'bar'})
|
|
assert_requested :post, "#{Stripe.api_base}/v1/plans/#{FIXTURE[:id]}"
|
|
assert plan.kind_of?(Stripe::Plan)
|
|
end
|
|
|
|
should "be deletable" do
|
|
plan = Stripe::Plan.retrieve(FIXTURE[:id])
|
|
plan = plan.delete
|
|
assert_requested :delete, "#{Stripe.api_base}/v1/plans/#{FIXTURE[:id]}"
|
|
assert plan.kind_of?(Stripe::Plan)
|
|
end
|
|
end
|
|
end
|