Sha256: 9d35d7807e8fc8af62a75625791486f2019447309599edf0c32b3f7e6913e5e5
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
# encoding: utf-8 require_relative '../test_helper' module PagarMe class PlanTest < Test::Unit::TestCase should 'be able to create a plan' do plan = test_plan plan.create test_plan_response(plan) end should 'be able to update plan' do plan = test_plan plan.create plan.name = "plano silver" plan.save assert plan.name == 'plano silver' end should 'be able to search by anything' do plan = test_plan plan.create plans = PagarMe::Plan.find_by({:trial_days => 5}) assert plans.size plans.each do |p| assert p.trial_days == 5 end end should 'be able to create with unformatted amount' do plan = test_plan plan.amount = 'R$ 10.00' plan.create assert plan.amount == 1000 end should 'validate plan' do exception = assert_raises PagarMeError do plan = Plan.new({ :amount => -1 }) plan.create end assert exception.errors.first.parameter_name == 'amount' exception = assert_raises PagarMeError do plan = Plan.new({ :amount => 1000, :days => -1, }) plan.create end assert exception.errors.first.parameter_name == 'days' exception = assert_raises PagarMeError do plan = Plan.new({ :amount => 1000, :days => 30, }) plan.create end assert exception.errors.first.parameter_name == 'name' exception = assert_raises PagarMeError do plan = Plan.new({ :amount => 1000, :days => 30, :name => "Plano Silver" }) plan.create plan.days = 'Plano gold' plan.save end assert exception.errors.first.parameter_name == 'days' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pagarme-1.9.5 | test/pagarme/plan.rb |
pagarme-1.9.4 | test/pagarme/plan.rb |
pagarme-1.9.3 | test/pagarme/plan.rb |