I am working on an RSpec test and am trying to make use of the have_selector method but it does not seem to be working as anticipated and the tests seem to pass regardless of what id i put in. I have tried with ‘organisation’ and ‘organizations’ which both pass regardless of the fact that it should only pass for :id => ‘minibar-organisations’
it "minibar should have uniquely named Organisations link" do
visit 'http://localhost:3000/'
minibar = find(:xpath, '//*[@id="minibar"]')
minibar.should have_selector('li', :id => 'minibar-organisation')
end
How can I effectively use this method so only those li that have this id will be recognised.
I don’t think
have_selectoractually takes an ‘id’ option. You can specify the expected ID as part of the selector instead: