Sha256: 2a2bf3c95ad53eb81c4234af7e8e62a7fd3b05ef528c070d0ab23bdff3e96663
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' describe Tellimus::Plan do describe '#is_upgrade_from?' do class FakePlan attr_accessor :price include Tellimus::Plan end it 'returns true if the price is higher' do plan = FakePlan.new plan.price = 123.23 cheaper_plan = FakePlan.new cheaper_plan.price = 61.61 expect(plan.is_upgrade_from?(cheaper_plan)).to eq(true) end it 'returns true if the price is the same' do plan = FakePlan.new plan.price = 123.23 expect(plan.is_upgrade_from?(plan)).to eq(true) end it 'returns false if the price is the same or higher' do plan = FakePlan.new plan.price = 61.61 more_expensive_plan = FakePlan.new more_expensive_plan.price = 123.23 expect(plan.is_upgrade_from?(more_expensive_plan)).to eq(false) end it 'handles a nil value gracefully' do plan = FakePlan.new plan.price = 123.23 cheaper_plan = FakePlan.new expect { expect(plan.is_upgrade_from?(cheaper_plan)).to eq(true) }.not_to raise_error end end end
Version data entries
5 entries across 5 versions & 1 rubygems