Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 23, 2011
@pascalw pascalw Impemented spec 2be34f6
Showing with 3 additions and 10 deletions.
  1. +2 −2 lib/elderly_discount_calculator.rb
  2. +1 −8 spec/elderly_discount_calculator_spec.rb
View
4 lib/elderly_discount_calculator.rb
@@ -20,8 +20,8 @@ def initialize(income, age, single)
#
# @return [Fixnum] Discount
def discount
- # TODO Exercise 1: Implement this method by making tests pass, try to incrementally implement the method. Choose one test and write just enough code to make it pass, then move on to the next test.
- raise NotImplementedError
+ return 0 if @age < 65 || @income > ELDERLY_DISCOUNT_MAXIMUM_INCOME
+ @single ? ELDERLY_DISCOUNT_SINGLE : ELDERLY_DISCOUNT
end
# Find out if a person is eligible for elderly discount, based on input
View
9 spec/elderly_discount_calculator_spec.rb
@@ -27,7 +27,6 @@ def calculator(attrs={})
end
it "should receive elderly discount for single person" do
- pending
calculator(@attrs).discount.should == ElderlyDiscountCalculator::ELDERLY_DISCOUNT_SINGLE
end
end
@@ -38,7 +37,6 @@ def calculator(attrs={})
end
it "should receive elderly discount for single person" do
- pending
calculator(@attrs).discount.should == ElderlyDiscountCalculator::ELDERLY_DISCOUNT_SINGLE
end
end
@@ -49,7 +47,6 @@ def calculator(attrs={})
end
it "should not receive elderly discount" do
- pending
calculator(@attrs).discount.should == 0
end
end
@@ -66,7 +63,6 @@ def calculator(attrs={})
end
it "should receive elderly discount" do
- pending
calculator(@attrs).discount.should == ElderlyDiscountCalculator::ELDERLY_DISCOUNT
end
end
@@ -77,7 +73,6 @@ def calculator(attrs={})
end
it "should receive elderly discount" do
- pending
calculator(@attrs).discount.should == ElderlyDiscountCalculator::ELDERLY_DISCOUNT
end
end
@@ -88,7 +83,6 @@ def calculator(attrs={})
end
it "should not receive elderly discount" do
- pending
calculator(@attrs).discount.should == 0
end
end
@@ -103,13 +97,12 @@ def calculator(attrs={})
end
it "should not receive elderly discount" do
- pending
calculator(@attrs).discount.should be_zero
end
end
end
describe "#eligible?" do
- it "should have specs"
+ # it "should have specs"
end
end

No commit comments for this range

Something went wrong with that request. Please try again.