From ce545120edee17d4cab948a88ee0b34a2d348751 Mon Sep 17 00:00:00 2001 From: Yuki Nishijima Date: Fri, 31 Jan 2014 19:30:25 -0800 Subject: [PATCH] Tweak spec for sinatra again --- spec/helpers/action_view_extension_spec.rb | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/spec/helpers/action_view_extension_spec.rb b/spec/helpers/action_view_extension_spec.rb index 376106d..732d794 100644 --- a/spec/helpers/action_view_extension_spec.rb +++ b/spec/helpers/action_view_extension_spec.rb @@ -248,7 +248,7 @@ describe 'Kaminari::ActionViewExtension' do describe '#rel_next_prev_link_tags' do before do - 75.times {|i| User.create! :name => "user#{i}"} + 80.times {|i| User.create! :name => "user#{i}"} end context 'the first page' do @@ -263,25 +263,25 @@ describe 'Kaminari::ActionViewExtension' do end context 'the middle page' do - before do - @users = User.page(2).per(25) - end - - subject { helper.rel_next_prev_link_tags @users, :params => {:controller => 'users', :action => 'index'} } - it { should match(/rel="prev"/) } - it { should match(/\?page=1/) } - it { should match(/rel="next"/) } - it { should match(/\?page=3/) } - end - - context 'the last page' do before do @users = User.page(3).per(25) end subject { helper.rel_next_prev_link_tags @users, :params => {:controller => 'users', :action => 'index'} } it { should match(/rel="prev"/) } - it { should match(/\?page=2"/) } + it { should match(/\?page=2/) } + it { should match(/rel="next"/) } + it { should match(/\?page=4/) } + end + + context 'the last page' do + before do + @users = User.page(4).per(25) + end + + subject { helper.rel_next_prev_link_tags @users, :params => {:controller => 'users', :action => 'index'} } + it { should match(/rel="prev"/) } + it { should match(/\?page=3"/) } it { should_not match(/rel="next"/) } end end