Skip to content

Commit

Permalink
Merge pull request #5558 from carlosantoniodasilva/fix-build-3-2
Browse files Browse the repository at this point in the history
Fix build for branch 3-2-stable - Part 2
  • Loading branch information
drogus committed Mar 23, 2012
2 parents ea4e021 + 0879ebd commit ef48cea
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions activerecord/test/cases/identity_map_test.rb
Expand Up @@ -301,20 +301,20 @@ def test_eager_loading_with_conditions_on_joined_table_preloads
posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id') posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id')
assert_equal [posts(:welcome)], posts assert_equal [posts(:welcome)], posts
assert_equal authors(:david), assert_no_queries { posts[0].author} assert_equal authors(:david), assert_no_queries { posts[0].author}
assert_same posts.first.author, Author.first assert_same posts.first.author, Author.order(:id).first


posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id') posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => "comments.body like 'Thank you%'", :order => 'posts.id')
assert_equal [posts(:welcome)], posts assert_equal [posts(:welcome)], posts
assert_equal authors(:david), assert_no_queries { posts[0].author} assert_equal authors(:david), assert_no_queries { posts[0].author}
assert_same posts.first.author, Author.first assert_same posts.first.author, Author.order(:id).first


posts = Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => "tags.name = 'General'", :order => 'posts.id') posts = Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => "tags.name = 'General'", :order => 'posts.id')
assert_equal posts(:welcome, :thinking), posts assert_equal posts(:welcome, :thinking), posts
assert_same posts.first.author, Author.first assert_same posts.first.author, Author.order(:id).first


posts = Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => "taggings_tags.super_tag_id=2", :order => 'posts.id') posts = Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => "taggings_tags.super_tag_id=2", :order => 'posts.id')
assert_equal posts(:welcome, :thinking), posts assert_equal posts(:welcome, :thinking), posts
assert_same posts.first.author, Author.first assert_same posts.first.author, Author.order(:id).first
end end


def test_eager_loading_with_conditions_on_string_joined_table_preloads def test_eager_loading_with_conditions_on_string_joined_table_preloads
Expand All @@ -336,38 +336,38 @@ def test_eager_loading_with_conditions_on_string_joined_table_preloads
############################################################################## ##############################################################################


def test_reload_object_if_save_failed def test_reload_object_if_save_failed
developer = Developer.first developer = Developer.order(:id).first
developer.salary = 0 developer.salary = 0


assert !developer.save assert !developer.save


same_developer = Developer.first same_developer = Developer.order(:id).first


assert_not_same developer, same_developer assert_not_same developer, same_developer
assert_not_equal 0, same_developer.salary assert_not_equal 0, same_developer.salary
assert_not_equal developer.salary, same_developer.salary assert_not_equal developer.salary, same_developer.salary
end end


def test_reload_object_if_forced_save_failed def test_reload_object_if_forced_save_failed
developer = Developer.first developer = Developer.order(:id).first
developer.salary = 0 developer.salary = 0


assert_raise(ActiveRecord::RecordInvalid) { developer.save! } assert_raise(ActiveRecord::RecordInvalid) { developer.save! }


same_developer = Developer.first same_developer = Developer.order(:id).first


assert_not_same developer, same_developer assert_not_same developer, same_developer
assert_not_equal 0, same_developer.salary assert_not_equal 0, same_developer.salary
assert_not_equal developer.salary, same_developer.salary assert_not_equal developer.salary, same_developer.salary
end end


def test_reload_object_if_update_attributes_fails def test_reload_object_if_update_attributes_fails
developer = Developer.first developer = Developer.order(:id).first
developer.salary = 0 developer.salary = 0


assert !developer.update_attributes(:salary => 0) assert !developer.update_attributes(:salary => 0)


same_developer = Developer.first same_developer = Developer.order(:id).first


assert_not_same developer, same_developer assert_not_same developer, same_developer
assert_not_equal 0, same_developer.salary assert_not_equal 0, same_developer.salary
Expand All @@ -379,10 +379,10 @@ def test_reload_object_if_update_attributes_fails
############################################################################## ##############################################################################


def test_find_using_identity_map_respects_readonly_when_loading_associated_object_first def test_find_using_identity_map_respects_readonly_when_loading_associated_object_first
author = Author.first author = Author.order(:id).first
readonly_comment = author.readonly_comments.first readonly_comment = author.readonly_comments.first


comment = Comment.first comment = Comment.order(:id).first
assert !comment.readonly? assert !comment.readonly?


assert readonly_comment.readonly? assert readonly_comment.readonly?
Expand All @@ -392,10 +392,10 @@ def test_find_using_identity_map_respects_readonly_when_loading_associated_objec
end end


def test_find_using_identity_map_respects_readonly def test_find_using_identity_map_respects_readonly
comment = Comment.first comment = Comment.order(:id).first
assert !comment.readonly? assert !comment.readonly?


author = Author.first author = Author.order(:id).first
readonly_comment = author.readonly_comments.first readonly_comment = author.readonly_comments.first


assert readonly_comment.readonly? assert readonly_comment.readonly?
Expand All @@ -405,13 +405,13 @@ def test_find_using_identity_map_respects_readonly
end end


def test_find_using_select_and_identity_map def test_find_using_select_and_identity_map
author_id, author = Author.select('id').first, Author.first author_id, author = Author.select('id').order(:id).first, Author.order(:id).first


assert_equal author_id, author assert_equal author_id, author
assert_same author_id, author assert_same author_id, author
assert_not_nil author.name assert_not_nil author.name


post, post_id = Post.first, Post.select('id').first post, post_id = Post.order(:id).first, Post.select('id').order(:id).first


assert_equal post_id, post assert_equal post_id, post
assert_same post_id, post assert_same post_id, post
Expand Down

0 comments on commit ef48cea

Please sign in to comment.