Skip to content

Instantly share code, notes, and snippets.

@mikel
Created September 2, 2011 04:23
Show Gist options
  • Save mikel/1187915 to your computer and use it in GitHub Desktop.
Save mikel/1187915 to your computer and use it in GitHub Desktop.
describe TaxCalculator do
context "low income bracket" do
it "should be zero cents in the dollar for income less than 6000" do
[-200, 0, 3000, 5999.99].each do |income_level|
subject.income = income_level
subject.should == 0
end
end
it "should not be zero cents in the dollar for a 6000 income" do
subject.income = 6000
subject.should > 0
end
end
context "15c income tax bracket" do
it "should bill 15c in the dollar for income between 6000 and 37000" do
[6000, 10000, 36999.99].each do |income_level|
subject.income = income_level
subject.should == (income_level * 0.15)
end
end
end
context "30c income tax bracket" do
it "should bill 30c in the dollar for income between 37000 and 80000" do
[37000, 50000, 79999.99].each do |income_level|
subject.income = income_level
subject.should == (income_level * 0.15)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment