Created
September 15, 2010 01:43
-
-
Save cee-dub/580112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: spec payment.rb | |
# Depends on Ruby and Rspec. | |
# | |
# Modify this code to compute the correct fee amount for a given payment amount. | |
# Add additional tests to cover any behavior you introduce. | |
class Payment | |
BASIS_POINTS = 290 | |
INTERCHANGE = 15 | |
def initialize(amount) | |
@amount = amount | |
end | |
end | |
describe Payment, "#fee_amount is calculated from the basis points and the interchange fee" do | |
it "returns 44 cents for $10.00" do | |
payment = Payment.new(10.00) | |
payment.fee_amount.should == 0.44 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment