Sha256: 235721e73649c0c8abbcb624fda5348a3d6389f463d542e55ef98f6febdb129b
Contents?: true
Size: 960 Bytes
Versions: 5
Compression:
Stored size: 960 Bytes
Contents
require 'spec_helper' describe "Indexing" do in_contexts do it "should know the index of an object in the collection" do @articles.all.each_with_index do |article, index| @articles.index_of(article).should == index end end it "should raise an error if asked for the index of an object not in the collection" do (Article.all - @articles.all).each do |article| lambda { @articles.index_of(article) }.should raise_error(ActiveRecord::RecordNotFound) end end it "should know the object after an object in the collection" do articles = @articles.all until articles.empty? do @articles.after(articles.shift).should == articles.first end end it "should know the object before an object in the collection" do articles = @articles.all until articles.empty? do @articles.before(articles.pop).should == articles.last end end end end
Version data entries
5 entries across 5 versions & 1 rubygems