ruby - How to test if all divs with class one has also class two in Rails integration test? -
i test in rails integration test, if divs class 1 has class 2 , if not, fail.
there may other classes, not relevant test.
this should pass:
<div class="one two">...</div> <div class="one 3 two">...</div> <div class="two one">...</div>
and should fail:
<div class="one two">...</div> <div class="one three">...</div> <div class="one">...</div>
thx!
you can using capybara.
let(:items) { page.find('div.one') } "items has both classes" items.each |item| expect(item[:class]).to match(/two/) end end
Comments
Post a Comment