2011-02-19 11:50:55 +00:00
|
|
|
|
# encoding: UTF-8
|
2011-12-10 16:15:18 +00:00
|
|
|
|
require 'spec_helper'
|
2011-02-07 13:37:31 +00:00
|
|
|
|
|
2011-02-08 02:21:39 +00:00
|
|
|
|
feature 'Users' do
|
|
|
|
|
background do
|
|
|
|
|
1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}" }
|
|
|
|
|
end
|
|
|
|
|
scenario 'navigating by pagination links' do
|
2011-12-10 17:56:19 +00:00
|
|
|
|
visit '/users'
|
2011-02-08 02:21:39 +00:00
|
|
|
|
|
2011-02-08 02:25:43 +00:00
|
|
|
|
within 'nav.pagination' do
|
2011-02-08 02:21:39 +00:00
|
|
|
|
within 'span.page.current' do
|
|
|
|
|
page.should have_content '1'
|
|
|
|
|
end
|
|
|
|
|
within 'span.next' do
|
2011-02-27 11:28:00 +00:00
|
|
|
|
click_link 'Next ›'
|
2011-02-08 02:21:39 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2011-02-08 02:25:43 +00:00
|
|
|
|
within 'nav.pagination' do
|
2011-02-08 02:21:39 +00:00
|
|
|
|
within 'span.page.current' do
|
|
|
|
|
page.should have_content '2'
|
|
|
|
|
end
|
2011-02-27 11:28:00 +00:00
|
|
|
|
within 'span.last' do
|
|
|
|
|
click_link 'Last »'
|
2011-02-08 02:21:39 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2011-02-08 02:25:43 +00:00
|
|
|
|
within 'nav.pagination' do
|
2011-02-08 02:21:39 +00:00
|
|
|
|
within 'span.page.current' do
|
|
|
|
|
page.should have_content '4'
|
|
|
|
|
end
|
|
|
|
|
within 'span.prev' do
|
2011-02-27 11:28:00 +00:00
|
|
|
|
click_link '‹ Prev'
|
2011-02-08 02:21:39 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2011-02-08 02:25:43 +00:00
|
|
|
|
within 'nav.pagination' do
|
2011-02-08 02:21:39 +00:00
|
|
|
|
within 'span.page.current' do
|
|
|
|
|
page.should have_content '3'
|
|
|
|
|
end
|
2011-02-27 11:28:00 +00:00
|
|
|
|
within 'span.first' do
|
|
|
|
|
click_link '« First'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
within 'nav.pagination' do
|
|
|
|
|
within 'span.page.current' do
|
|
|
|
|
page.should have_content '1'
|
|
|
|
|
end
|
2011-02-08 02:21:39 +00:00
|
|
|
|
end
|
2011-02-07 13:37:31 +00:00
|
|
|
|
end
|
|
|
|
|
end
|