I have next html code:
<ul class="nav">
<li class="active">
<a href="/users/page">Page</a>
</li>
...
</ul>
I want to make sure that i have li tag with class "active" and inside of that text.
So, i tried that:
response.should have_selector( "li", :class => "active" ,:content => "Page")
And it doesn't work, i get such error:
Failure/Error: response.should have_selector( "li", :class => "active" ,:content => "Page")
expected following output to contain a <li class='active'>Page</li> tag:
How can i solve my problem?
I think you can add the class to the css selector. Something like:
response.body.should have_selector( "li.active", :content => 'Page')
I solved it:
response.body.should have_selector( "li.active") do
have_selector('a', :content => 'Pages')
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With