Sha256: 87e0a6663875fc305eda75f2c572ced30338f48cf7aadc77132c778ab11611e4
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require_relative '../../test_helper' module PagarMe class PlanTest < PagarMeTestCase should 'be able to create a plan' do plan = PagarMe::Plan.create plan_params assert_plan_created plan end should 'be able to update plan' do plan = PagarMe::Plan.create plan_params assert_plan_created plan plan.name = 'plano bronze' plan.save assert_equal plan.name, 'plano bronze' end should 'be able to search by anything' do assert_plan_created PagarMe::Plan.create(plan_params) # find_by_hash is possibly consistent, wait to try to ensure!!! sleep 5 found_plans = PagarMe::Plan.find_by trial_days: 5 assert found_plans.size > 0 found_plans.each do |plan| assert_equal plan.trial_days, 5 end end should 'validate plan amount' do exception = assert_raises(PagarMe::ValidationError){ Plan.create amount: -1 } assert_has_error_param exception, 'amount' end should 'validate plan days' do exception = assert_raises(PagarMe::ValidationError){ Plan.create amount: 1000, days: -1 } assert_has_error_param exception, 'days' end should 'validate plan with missing name' do exception = assert_raises(PagarMe::ValidationError){ Plan.create amount: 1000, days: 20 } assert_has_error_param exception, 'name' end should 'not be possible to edit days' do plan = Plan.create amount: 1000, days: 20, name: 'Plano Platinum' exception = assert_raises(PagarMe::ValidationError) do plan.days = 30 plan.save end assert_has_error_param exception, 'days' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pagarme-2.4.0 | test/pagarme/resources/plan_test.rb |