Sha256: bfcba13248fe90a57c8980e127cbaab6bfa8fd7a4da275fe418f06848d892154
Contents?: true
Size: 1.63 KB
Versions: 8
Compression:
Stored size: 1.63 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 '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
8 entries across 8 versions & 1 rubygems