Sha256: f1baa5ce8df92919723d72258c04cbe9bcb13a8351ff2f6a0983bf420540833d

Contents?: true

Size: 1023 Bytes

Versions: 21

Compression:

Stored size: 1023 Bytes

Contents

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

module Stripe
  class PlanTest < Test::Unit::TestCase
    should "plans should be listable" do
      @mock.expects(:get).once.returns(make_response(make_plan_array))
      plans = Stripe::Plan.list
      assert plans.data.kind_of?(Array)
      plans.each do |plan|
        assert plan.kind_of?(Stripe::Plan)
      end
    end

    should "plans should be saveable" do
      @mock.expects(:get).once.returns(make_response(make_plan))
      @mock.expects(:post).once.returns(make_response(make_plan))
      p = Stripe::Plan.new("test_plan")
      p.refresh
      p.metadata['foo'] = 'bar'
      p.save
    end

    should "plans should be updateable" do
      @mock.expects(:post).once.
        with('https://api.stripe.com/v1/plans/test_plan', nil, 'metadata[foo]=bar').
        returns(make_response(make_plan(metadata: {foo: 'bar'})))
      p = Stripe::Plan.update("test_plan", metadata: {foo: 'bar'})
      assert_equal('bar', p.metadata['foo'])
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
stripe-1.58.0 test/stripe/plan_test.rb
stripe-1.57.1 test/stripe/plan_test.rb
stripe-1.57.0 test/stripe/plan_test.rb
stripe-1.56.2 test/stripe/plan_test.rb
stripe-1.56.1 test/stripe/plan_test.rb
stripe-1.56.0 test/stripe/plan_test.rb
stripe-1.55.1 test/stripe/plan_test.rb
stripe-1.55.0 test/stripe/plan_test.rb
stripe-1.54.0 test/stripe/plan_test.rb
stripe-1.53.0 test/stripe/plan_test.rb
stripe-1.52.0 test/stripe/plan_test.rb
stripe-1.51.1 test/stripe/plan_test.rb
stripe-1.51.0 test/stripe/plan_test.rb
stripe-1.50.1 test/stripe/plan_test.rb
stripe-1.50.0 test/stripe/plan_test.rb
stripe-1.49.0 test/stripe/plan_test.rb
stripe-1.48.0 test/stripe/plan_test.rb
stripe-1.47.0 test/stripe/plan_test.rb
stripe-1.46.0 test/stripe/plan_test.rb
stripe-1.45.0 test/stripe/plan_test.rb