Sha256: 168056bfad17cad5b37b209580a150173180862f378c6b69cc49a9e52e6647fe

Contents?: true

Size: 1.48 KB

Versions: 17

Compression:

Stored size: 1.48 KB

Contents

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

module Stripe
  class PlanTest < Test::Unit::TestCase
    should "be listable" do
      plans = Stripe::Plan.list
      assert_requested :get, "#{Stripe.api_base}/v1/plans"
      assert plans.data.is_a?(Array)
      assert plans.data[0].is_a?(Stripe::Plan)
    end

    should "be retrievable" do
      plan = Stripe::Plan.retrieve("sapphire-elite")
      assert_requested :get, "#{Stripe.api_base}/v1/plans/sapphire-elite"
      assert plan.is_a?(Stripe::Plan)
    end

    should "be creatable" do
      plan = Stripe::Plan.create(
        amount: 5000,
        interval: "month",
        name: "Sapphire elite",
        currency: "usd",
        id: "sapphire-elite"
      )
      assert_requested :post, "#{Stripe.api_base}/v1/plans"
      assert plan.is_a?(Stripe::Plan)
    end

    should "be saveable" do
      plan = Stripe::Plan.retrieve("sapphire-elite")
      plan.metadata["key"] = "value"
      plan.save
      assert_requested :post, "#{Stripe.api_base}/v1/plans/#{plan.id}"
    end

    should "be updateable" do
      plan = Stripe::Plan.update("sapphire-elite", metadata: { foo: "bar" })
      assert_requested :post, "#{Stripe.api_base}/v1/plans/sapphire-elite"
      assert plan.is_a?(Stripe::Plan)
    end

    should "be deletable" do
      plan = Stripe::Plan.retrieve("sapphire-elite")
      plan = plan.delete
      assert_requested :delete, "#{Stripe.api_base}/v1/plans/#{plan.id}"
      assert plan.is_a?(Stripe::Plan)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
stripe-3.12.1 test/stripe/plan_test.rb
stripe-3.12.0 test/stripe/plan_test.rb
stripe-3.11.0 test/stripe/plan_test.rb
stripe-3.10.0 test/stripe/plan_test.rb
stripe-3.9.2 test/stripe/plan_test.rb
stripe-3.9.1 test/stripe/plan_test.rb
stripe-3.9.0 test/stripe/plan_test.rb
stripe-3.8.2 test/stripe/plan_test.rb
stripe-3.8.1 test/stripe/plan_test.rb
stripe-3.8.0 test/stripe/plan_test.rb
stripe-3.7.0 test/stripe/plan_test.rb
stripe-3.6.0 test/stripe/plan_test.rb
stripe-3.5.3 test/stripe/plan_test.rb
stripe-3.5.2 test/stripe/plan_test.rb
stripe-3.5.1 test/stripe/plan_test.rb
stripe-3.5.0 test/stripe/plan_test.rb
stripe-3.4.1 test/stripe/plan_test.rb