1
0

Implement remaining_budget? method in discount budget

This commit is contained in:
Tim Kächele 2021-03-06 20:28:48 +01:00
parent c4528b1c92
commit 65dd309569
2 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,10 @@ module PlanetExpress
budget - spent_budget
end
def remaining_budget?
!available_budget.zero?
end
private
attr_reader :applied_discounts

View File

@ -9,6 +9,7 @@ RSpec.describe PlanetExpress::DiscountBudget do
it 'returns the full discount' do
expect(subject.apply_discount(120)).to eq(120)
expect(subject.available_budget).to eq(380)
expect(subject.remaining_budget?).to eq(true)
end
end
@ -16,6 +17,7 @@ RSpec.describe PlanetExpress::DiscountBudget do
it 'returns only the remaining budget' do
expect(subject.apply_discount(650)).to eq(500)
expect(subject.available_budget).to eq(0)
expect(subject.remaining_budget?).to eq(false)
end
end
end