Sha256: 1cd38061f0349be88b0adab8d76f3f9e22e9a34dae2c2824ee3b498ad69546bf

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

# encoding: utf-8
require_relative '../test_helper'

module PagarMe
	class SubscriptionTest < Test::Unit::TestCase
	  should 'be able to create subscription with plan' do
		plan = test_plan
		plan.create
		subscription = test_subscription
		subscription.plan = plan
		subscription.create
		test_plan_response(subscription.plan)
		test_transaction_with_customer(subscription)
	  end

	  should 'be able to create subscription without plan' do
		subscription = test_subscription({:amount => 2000})
		subscription.create
		assert subscription.transactions.length == 1
		subscription.charge(2000)
		assert subscription.transactions.length == 2
		assert subscription.transactions.first.kind_of?(PagarMe::Transaction)
		subscription.transactions.each do |t|
		  test_subscription_transaction_response(t)
		end
	  end

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagarme-1.0 test/pagarme/subscription.rb