Sha256: b3e029bae7aa094a54f2401e4a2c1501480d4f37c7bb8036d8d1eaf2c3a244c0

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

require 'spec_helper'

describe "Context" do
  in_contexts do
    it "should know the object after an object obtained with #all" do
      articles = @articles.all
      until articles.empty? do
        articles.shift.next.should == articles.first
      end
    end

    it "should know the object before an object obtained with #all" do
      articles = @articles.all
      until articles.empty? do
        articles.pop.previous.should == articles.last
      end
    end
    
    it "should be known for an object obtained with #first" do
      @articles.all.should have_at_least(2).articles
      @articles.first.next.should_not be_nil
      @articles.first.previous.should be_nil
    end
    # (For a collection including :limit , this won't work with #last unless the collection
    # has been evaluated already!)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mholling-paged_scopes-0.0.3 spec/context_spec.rb
mholling-paged_scopes-0.0.4 spec/context_spec.rb
mholling-paged_scopes-0.0.5 spec/context_spec.rb
mholling-paged_scopes-0.1.0 spec/context_spec.rb