Sha256: ab524919affe698a38db12d53536bbf4b41d3e65ba5164d54452c420d351240e

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

require 'spec_helper'

describe Loan do
  it "should return initial set nominal rate" do
    loan = Loan.new(10, 12, 1000)
    expect(loan.nominal_rate).to eq(10)
  end

  it "should return initial set duration period" do
    loan = Loan.new(10, 12, 1000)
    expect(loan.duration).to eq(12)
  end

  it "should return initial set amount loaned" do
    loan = Loan.new(10, 12, 1000)
    expect(loan.amount).to eq(1000)
  end

  context ".pmt" do

    it "should return correct pmt value" do
      loan = Loan.new(10, 12, 1000)
      expect(loan.pmt).to eq(87.9158872300099)
    end

    it "should return correct pmt value" do
      loan = Loan.new(0, 12, 1200)
      expect(loan.pmt).to eq(100)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
finance_math-0.0.1 spec/lib/loan_spec.rb