I use Capybara with Rspec and have the following code on my page:
<div class="pagination pagination-centered">
<ul>
// ...
<li class="last">
<a href="/en/articles?page=2">Last »</a>
</li>
</ul>
</div>
I want to check in the request that a div with class “pagination pagination-centered” exists. I tried this:
it "should have pagination" do
page.should have_selector('div#pagination pagination-centered')
end
And this:
it "should have pagination" do
page.should have_selector('div', :class => 'pagination pagination-centered')
end
And neither work. How should I solve the problem?
OK, I found the solution. I should use
have_cssmethod: