Sha256: 7e3a1bfe505bdcd5f72eb80b581c17ae341aa753243d0b2eb48e0ed52269764f
Contents?: true
Size: 1.06 KB
Versions: 13
Compression:
Stored size: 1.06 KB
Contents
require 'helper' describe Toy::Equality do uses_constants('User', 'Game', 'Person') describe "#eql?" do it "returns true if same class and id" do User.new(:id => 1).should eql(User.new(:id => 1)) end it "return false if different class" do User.new(:id => 1).should_not eql(Person.new(:id => 1)) end it "returns false if different id" do User.new(:id => 1).should_not eql(User.new(:id => 2)) end it "returns true if reference and target is same class and id" do Game.reference(:user) user = User.create game = Game.create(:user => user) user.should eql(game.user) end end describe "equal?" do it "returns true if same object" do user = User.create(:id => 1) user.should equal(user) end it "returns true if same object through proxy" do Game.reference(:user) user = User.create game = Game.create(:user => user) user.should equal(game.user) game.user.should equal(user) end it "returns false if not same object" do end end end
Version data entries
13 entries across 13 versions & 1 rubygems