Permalink
Browse files

Changed tests, so that it isn't tested on the original value.

  • Loading branch information...
1 parent f36a015 commit 753adea9dd0af265270e740bc1dbb090bcd52660 @DefV DefV committed Mar 31, 2008
Showing with 11 additions and 11 deletions.
  1. +11 −11 test/deep_cloning_test.rb
@@ -10,44 +10,44 @@ def setup
def test_single_clone_exception
clone = @jack.clone(:except => :name)
assert clone.save
- assert_equal @jack.name, @jack.clone.name
+ assert_equal pirates(:jack).name, @jack.clone.name # Old behavour
assert_nil clone.name
- assert_equal @jack.nick_name, clone.nick_name
+ assert_equal pirates(:jack).nick_name, clone.nick_name
end
def test_multiple_clone_exception
clone = @jack.clone(:except => [:name, :nick_name])
assert clone.save
assert_nil clone.name
assert_equal 'no nickname', clone.nick_name
- assert_equal @jack.age, clone.age
+ assert_equal pirates(:jack).age, clone.age
end
def test_single_include_association
clone = @jack.clone(:include => :mateys)
assert clone.save
- assert_equal @jack.mateys.size, clone.mateys.size
+ assert_equal 1, clone.mateys.size
end
def test_multiple_include_association
clone = @jack.clone(:include => [:mateys, :treasures])
assert clone.save
- assert_equal @jack.mateys.size, clone.mateys.size
- assert_equal @jack.treasures.size, clone.treasures.size
+ assert_equal 1, clone.mateys.size
+ assert_equal 1, clone.treasures.size
end
def test_deep_include_association
clone = @jack.clone(:include => {:treasures => :gold_pieces})
assert clone.save
- assert_equal @jack.treasures.size, clone.treasures.size
- assert_equal @jack.gold_pieces.size, clone.gold_pieces.size
+ assert_equal 1, clone.treasures.size
+ assert_equal 1, clone.gold_pieces.size
end
def test_multiple_and_deep_include_association
clone = @jack.clone(:include => {:treasures => :gold_pieces, :mateys => {}})
assert clone.save
- assert_equal @jack.treasures.size, clone.treasures.size
- assert_equal @jack.gold_pieces.size, clone.gold_pieces.size
- assert_equal @jack.mateys.size, clone.mateys.size
+ assert_equal 1, clone.treasures.size
+ assert_equal 1, clone.gold_pieces.size
+ assert_equal 1, clone.mateys.size
end
end

0 comments on commit 753adea

Please sign in to comment.