blob: 9716db22f87b655dd3437a5893382c984422be48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
require "spec_helper"
describe Money do
context "when comparing money" do
context "when the amount is the same" do
it "should return true" do
Money.new(1.00).should == Money.new(1.00)
Money.new(10.00).should eq(Money.new(10.00))
end
end
context "when the amount is different" do
it "should return false" do
Money.new(1.00).should_not == Money.new(10.00)
Money.new(10.00).should_not eq(Money.new(1.00))
end
end
end
context "when adding money" do
it "should return the new amount" do
result = Money.new(1.99) + Money.new(0.01)
result.should == Money.new(2.00)
end
end
end
|