Permalink
Browse files

Aliased offset to skip.

  • Loading branch information...
jnunemaker committed Jun 19, 2010
1 parent 9b2665e commit 395bec7f723293cdb8bc81ab5d0f97ff0f361f6d
Showing with 7 additions and 2 deletions.
  1. +1 −0 lib/plucky/query.rb
  2. +6 −2 test/plucky/test_query.rb
View
@@ -120,6 +120,7 @@ def reverse
def skip(count=nil)
clone.tap { |query| query.options[:skip] = count }
end
alias offset skip
def sort(*args)
clone.tap { |query| query.options[:sort] = *args }
@@ -366,6 +366,10 @@ class QueryTest < Test::Unit::TestCase
new_query.should_not equal(subject)
subject[:skip].should be_nil
end
should "alias to offset" do
subject.offset(5).options[:skip].should == 5
end
end
context "#limit" do
@@ -421,7 +425,7 @@ class QueryTest < Test::Unit::TestCase
new_query.should_not equal(subject)
subject[:sort].should be_nil
end
should "be aliased to order" do
subject.order(:foo).options[:sort].should == [['foo', 1]]
subject.order(:foo, :bar).options[:sort].should == [['foo', 1], ['bar', 1]]
@@ -524,7 +528,7 @@ class QueryTest < Test::Unit::TestCase
Query.new(@collection).exists?(:name => 'Billy Bob').should be(false)
end
end
context "#exist?" do
should "be true if found" do
Query.new(@collection).exist?(:name => 'John').should be(true)

0 comments on commit 395bec7

Please sign in to comment.