Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fbe/award.rb
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def line(value, text)
# bill.line(42.5, "for answer")
# bill.points #=> 43
def points
@lines.sum { |l| whole(l[:v]) }
whole(@lines.sum { |l| l[:v] })
end

# Generates a human-readable summary of the bill.
Expand Down
7 changes: 7 additions & 0 deletions test/fbe/test_award.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ def test_lines_add_up_to_the_total
assert_equal("You've earned +20 points for this: +12 as a basis; +8 for comments. ", g)
end

def test_rounds_the_sum_once
bill = Fbe::Award::Bill.new
bill.line(0.5, 'first')
bill.line(0.5, 'second')
assert_equal(1, bill.points)
end

def test_shorten_when_one_number
g = Fbe::Award.new('(award (give 23 "for love"))').bill.greeting
assert_equal('You\'ve earned +23 points. ', g, g)
Expand Down
Loading