Skip to content

Commit

Permalink
mixing conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesilveira committed Oct 5, 2010
1 parent 76fcc25 commit 743e001
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/dsl_test.rb
Expand Up @@ -118,7 +118,7 @@ class DSLTest < ActiveSupport::TestCase
assert_equal 1, posts.size
end

test "accepts two conditions" do
test "accepts two conditions inline" do
@caelum.update_attributes :published_at => 1.year.ago
@guilherme.update_attributes :published_at => 1.year.ago

Expand All @@ -130,6 +130,15 @@ class DSLTest < ActiveSupport::TestCase
assert_equal 1, posts.size
end

test "supports two conditions in dsl mixing everything together" do
@caelum.update_attributes(:comments => [Comment.create, Comment.create])
@guilherme.update_attributes(:comments => [Comment.create, Comment.create, Comment.create])
posts = Post.where { comments >= 1 }.where(:body).like?("%lum%")
assert_equal @caelum, posts[0]
assert_equal 1, posts.size
end


# def pending
# posts = Post.where { comments.description.like?("%dsl test%") }
# posts = posts.and(:authors).count.lt(3)
Expand Down

0 comments on commit 743e001

Please sign in to comment.