Sha256: 86c4c437abeb42cea1c454bae67937a24bc3cbddca4282d3874e4fa80f5e546a

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

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

module Paid
  # SubscriptionTest
  class SubscriptionTest < Test::Unit::TestCase
    should 'retrieve should retrieve subscriptions' do
      @mock.expects(:get).once.returns(test_response(test_subscription))
      i = Paid::Subscription.retrieve('in_test_subscription')
      assert_equal 'sub_test_subscription', i.id
    end

    should 'create should create a new subscription' do
      @mock.expects(:post).once.returns(test_response(test_subscription))
      i = Paid::Subscription.create
      assert_equal 'sub_test_subscription', i.id
    end

    should 'subscriptions should be cancellable' do
      @mock.expects(:get).never
      @mock.expects(:post).once.returns(
        test_response(
          id: 'sub_test_subscription',
          cancelled_at: 123_456_789
        )
      )
      s = Paid::Subscription.new('test_subscription')
      s.cancel
      assert !s.cancelled_at.nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paid-0.1.0 test/paid/subscription_test.rb