-
Notifications
You must be signed in to change notification settings - Fork 51
Home
Faacy Farook edited this page Jan 14, 2016
·
11 revisions
Table of Contents
Test rspec spec/pagination_spec.rb fails fails with the following error message:
Failure/Error: click_link("#{p+1}", :href => "/?page=#{p+1}")
Capybara::ElementNotFound:
Unable to find link "2" with href "/?page=2"
# ./spec/pagination_spec.rb:40:in `block (4 levels) in <top (required)>'
# ./spec/pagination_spec.rb:38:in `block (3 levels) in <top (required)>'
# ./spec/pagination_spec.rb:13:in `block (2 levels) in <top (required)>'
But when manually going to the other pages on the browser, there is no problem.
A: In the routes.rb
set the root at the beginning
Rails.application.routes.draw do
root to: 'todo_lists#index'
...
end
For example, verify that when you login to the site, in the pagination control,
that the HTML for the link to the second page is as following:
```html
<a rel="next" href="/?page=2">2</a>
Note that the rspec test is looking for the link to be /?page=2
and not /todolists?page=2
.