Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7585229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:07:33+00:00 2026-05-30T19:07:33+00:00

I am working on an RSpec test and am trying to make use of

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:07:34+00:00Added an answer on May 30, 2026 at 7:07 pm

    I don’t think have_selector actually takes an ‘id’ option. You can specify the expected ID as part of the selector instead:

    minibar.should have_selector('li#minibar-organisation')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to get a backtrace with rspec but I can't get it working
I have a very simple RSpec Capybara have_selector() that doesn't seem to be working
I'm not sure what's going on, but I can't get simple tests to work
I'm having trouble getting my rspec routing tests working with a subdomain constraint. Specifically
I am working on a basic Rspec test using Capybara that opens a webpage
I am trying to sort out my RSpec tests for a controller of mine,
I've been trying to get a grasp on writing tests, but having a lot
I'm trying to write an rspec for my Rooms controller to test permissions with
I am trying to get my test suite working and am having some issues.
I'm trying to keep my specs clean and DRY, but I have some tests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.