Permalink
Browse files

added unit-test for Post#prev and Post#next

  • Loading branch information...
1 parent b39a6c9 commit 6891cb8a3db805833afcb21c28b0629337d6e07d @noriaki committed Feb 7, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 spec/post_spec.rb
View
@@ -65,6 +65,18 @@
end
end
+ context "previous or next" do
+ it "should return previous page instance" do
+ Post.get(10).prev.should == Post.get(3)
+ Post.get(10).prev.created_at.should < Post.get(10).created_at
+ end
+
+ it "should return next page instance" do
+ Post.get(3).next.should == Post.get(10)
+ Post.get(3).next.created_at.should > Post.get(3).created_at
+ end
+ end
+
describe '.first' do
it { lambda { Post.first }.should_not raise_error }
end

0 comments on commit 6891cb8

Please sign in to comment.