Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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