Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding tests for #5234 and #5184. Tests were from Akira Matsuda. Than…

…ks Akira!
  • Loading branch information...
commit 3bc12d3ee6691dc6bf8efe82de42549f1cab1c0c 1 parent ae7a354
@tenderlove tenderlove authored
View
6 activerecord/test/cases/method_scoping_test.rb
@@ -226,6 +226,12 @@ def test_scoped_create
assert Post.find(1).comments.include?(new_comment)
end
+ def test_scoped_create_with_join_and_merge
+ (Comment.where(:body => "but Who's Buying?").joins(:post) & Post.where(:body => 'Peace Sells...')).with_scope do
+ assert_equal({:body => "but Who's Buying?"}, Comment.scoped.scope_for_create)
+ end
+ end
+
def test_immutable_scope
options = { :conditions => "name = 'David'" }
Developer.send(:with_scope, :find => options) do
View
5 activerecord/test/cases/relations_test.rb
@@ -506,6 +506,11 @@ def test_relation_merging_with_preload
end
end
+ def test_relation_merging_with_joins
+ comments = Comment.joins(:post).where(:body => 'Thank you for the welcome') & Post.where(:body => 'Such a lovely day')
+ assert_equal 1, comments.count
+ end
+
def test_count
posts = Post.scoped
Please sign in to comment.
Something went wrong with that request. Please try again.