Sha256: ca929eda6addb255b7e63a87286ee28a4905bba884cc0184e38fe7556865b0ef
Contents?: true
Size: 1.07 KB
Versions: 10
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' describe Koudoku::Plan do describe '#is_upgrade_from?' do class FakePlan attr_accessor :price include Koudoku::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
10 entries across 10 versions & 2 rubygems