Permalink
Browse files

Added Collection#skip and Collection#limit.

  • Loading branch information...
1 parent 53a22b4 commit 9583797b4f35e06a3f88da365ac3fca3b56fd089 @jnunemaker jnunemaker committed May 3, 2010
Showing with 13 additions and 1 deletion.
  1. +1 −1 lib/plucky/collection.rb
  2. +12 −0 test/test_collection.rb
View
@@ -15,7 +15,7 @@ def initialize(collection)
@collection = collection
end
- query_delegator :sort, :filter
+ query_delegator :sort, :filter, :skip, :limit
def all(options={})
query.update(options)
View
@@ -86,5 +86,17 @@ class CollectionTest < Test::Unit::TestCase
@collection.filter(:age.lt => 29).filter(:name => 'Chris').all.should == [@chris]
end
end
+
+ context "#skip" do
+ should "work" do
+ @collection.skip(2).all(:order => :age).should == [@steve]
+ end
+ end
+
+ context "#limit" do
+ should "work" do
+ @collection.limit(2).all(:order => :age).should == [@chris, @john]
+ end
+ end
end
end

0 comments on commit 9583797

Please sign in to comment.