Value: change to_s to use sprintf()
This commit is contained in:
parent
762b7c6413
commit
983861c1dc
@ -25,7 +25,7 @@ module Gnucash
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
(@val / 100.0).round(2).to_s
|
sprintf("%.02f", @val / 100.0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -30,5 +30,9 @@ module Gnucash
|
|||||||
c = a - b
|
c = a - b
|
||||||
c.to_s.should == "-123.99"
|
c.to_s.should == "-123.99"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "formats the number with two decimal places" do
|
||||||
|
Value.new("1400/100").to_s.should == "14.00"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user