Skip to content

Instantly share code, notes, and snippets.

@perryqh
Created May 17, 2010 14:11
Show Gist options
  • Save perryqh/403798 to your computer and use it in GitHub Desktop.
Save perryqh/403798 to your computer and use it in GitHub Desktop.
context "with valid MortgageUtil" do
before(:all) do
@mortgage_util = MortgageUtil.new(100000, 6.0, 360, 1200, 1.25)
end
it "should have proper monthly interest rate" do
@mortgage_util.send(:monthly_interst_rate).should == 0.005
end
it "should have proper monthly payment" do
@mortgage_util.monthly_payment.should be_close(599.55, 0.001)
end
it "should have proper total fees" do
@mortgage_util.total_fees.should be_close(2450, 0.001)
end
it "should have proper APR" do
@mortgage_util.apr.should be_close(6.22726, 0.00001)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment