๐Ÿ“ฆ AlanGabbianelli / Cake

๐Ÿ“„ percentage_promotion_spec.rb ยท 18 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18require 'percentage_promotion'

describe PercentagePromotion do
  subject(:percentage_promotion) { described_class.new }

  it 'is applied when total is equal to minimum amount (60.00 by default)' do
    expect(percentage_promotion.apply({}, 60.00)).to eq(6.00)
  end

  it 'is applied when total is greater than minimum amount' do
    expect(percentage_promotion.apply({}, 61.00)).to eq(6.10)
  end

  it 'is not applied when total is less than minimum amount' do
    expect(percentage_promotion.apply({}, 59.99)).to eq(0.00)
  end
end