1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Put empty lines for readability [ci skip]

This commit is contained in:
Yuki Nishijima 2013-12-02 12:24:58 +09:00
parent 19efbcd8d4
commit 90915c8ea4

View file

@ -6,6 +6,7 @@ describe 'Kaminari::ActionViewExtension' do
50.times {|i| User.create! :name => "user#{i}"}
@users = User.page(1)
end
subject { helper.paginate @users, :params => {:controller => 'users', :action => 'index'} }
it { should be_a String }
@ -20,24 +21,29 @@ describe 'Kaminari::ActionViewExtension' do
before do
50.times {|i| User.create! :name => "user#{i}"}
end
context 'having previous pages' do
before do
@users = User.page(50)
end
context 'the default behaviour' do
subject { helper.link_to_previous_page @users, 'Previous', :params => {:controller => 'users', :action => 'index'} }
it { should be_a String }
it { should match(/rel="previous"/) }
end
context 'overriding rel=' do
subject { helper.link_to_previous_page @users, 'Previous', :rel => 'external', :params => {:controller => 'users', :action => 'index'} }
it { should match(/rel="external"/) }
end
end
context 'the first page' do
before do
@users = User.page(1)
end
subject { helper.link_to_previous_page @users, 'Previous', :params => {:controller => 'users', :action => 'index'} }
it { should_not be }
end
@ -47,24 +53,29 @@ describe 'Kaminari::ActionViewExtension' do
before do
50.times {|i| User.create! :name => "user#{i}"}
end
context 'having more page' do
before do
@users = User.page(1)
end
context 'the default behaviour' do
subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
it { should be_a String }
it { should match(/rel="next"/) }
end
context 'overriding rel=' do
subject { helper.link_to_next_page @users, 'More', :rel => 'external', :params => {:controller => 'users', :action => 'index'} }
it { should match(/rel="external"/) }
end
end
context 'the last page' do
before do
@users = User.page(2)
end
subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
it { should_not be }
end
@ -75,6 +86,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@users = User.page(1).per(25)
end
context 'having no entries' do
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'No users found' }
@ -90,6 +102,7 @@ describe 'Kaminari::ActionViewExtension' do
User.create! :name => 'user1'
@users = User.page(1).per(25)
end
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'Displaying <b>1</b> user' }
@ -104,6 +117,7 @@ describe 'Kaminari::ActionViewExtension' do
10.times {|i| User.create! :name => "user#{i}"}
@users = User.page(1).per(25)
end
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'Displaying <b>all 10</b> users' }
@ -122,6 +136,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@users = User.page(1).per(25)
end
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'Displaying users <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total' }
@ -135,6 +150,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@users = User.page(2).per(25)
end
subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
it { should == 'Displaying users <b>26&nbsp;-&nbsp;50</b> of <b>50</b> in total' }
@ -149,6 +165,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@addresses = User::Address.page(1).per(25)
end
context 'having no entries' do
subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
it { should == 'No addresses found' }
@ -159,6 +176,7 @@ describe 'Kaminari::ActionViewExtension' do
User::Address.create!
@addresses = User::Address.page(1).per(25)
end
subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
it { should == 'Displaying <b>1</b> address' }
@ -173,6 +191,7 @@ describe 'Kaminari::ActionViewExtension' do
10.times {|i| User::Address.create!}
@addresses = User::Address.page(1).per(25)
end
subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
it { should == 'Displaying <b>all 10</b> addresses' }
@ -191,6 +210,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@addresses = User::Address.page(1).per(25)
end
subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
it { should == 'Displaying addresses <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total' }
@ -204,6 +224,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@addresses = User::Address.page(2).per(25)
end
subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
it { should == 'Displaying addresses <b>26&nbsp;-&nbsp;50</b> of <b>50</b> in total' }
@ -219,6 +240,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
@numbers = Kaminari.paginate_array(%w{one two three}).page(1)
end
subject { helper.page_entries_info @numbers }
it { should == 'Displaying <b>all 3</b> entries' }
end
@ -228,6 +250,7 @@ describe 'Kaminari::ActionViewExtension' do
before do
75.times {|i| User.create! :name => "user#{i}"}
end
context 'the first page' do
before do
@users = User.page(1).per(25)
@ -238,6 +261,7 @@ describe 'Kaminari::ActionViewExtension' do
it { should match(/rel="next"/) }
it { should_not match(/rel="prev"/) }
end
context 'the middle page' do
before do
@users = User.page(2).per(25)
@ -248,6 +272,7 @@ describe 'Kaminari::ActionViewExtension' do
it { should match(/rel="next"/) }
it { should match(/rel="prev"/) }
end
context 'the last page' do
before do
@users = User.page(3).per(25)