Skip to content

Commit

Permalink
Impemented spec
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalw committed Sep 23, 2011
1 parent d502476 commit 2be34f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/elderly_discount_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions spec/elderly_discount_calculator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -49,7 +47,6 @@ def calculator(attrs={})
end

it "should not receive elderly discount" do
pending
calculator(@attrs).discount.should == 0
end
end
Expand All @@ -66,7 +63,6 @@ def calculator(attrs={})
end

it "should receive elderly discount" do
pending
calculator(@attrs).discount.should == ElderlyDiscountCalculator::ELDERLY_DISCOUNT
end
end
Expand All @@ -77,7 +73,6 @@ def calculator(attrs={})
end

it "should receive elderly discount" do
pending
calculator(@attrs).discount.should == ElderlyDiscountCalculator::ELDERLY_DISCOUNT
end
end
Expand All @@ -88,7 +83,6 @@ def calculator(attrs={})
end

it "should not receive elderly discount" do
pending
calculator(@attrs).discount.should == 0
end
end
Expand All @@ -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

0 comments on commit 2be34f6

Please sign in to comment.