Skip to content

Instantly share code, notes, and snippets.

@cee-dub
Created September 15, 2010 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cee-dub/580112 to your computer and use it in GitHub Desktop.
Save cee-dub/580112 to your computer and use it in GitHub Desktop.
# 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