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 4036184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:11:31+00:00 2026-05-20T12:11:31+00:00

The page url is something like /people?search=name while I used current_path method of capybara

  • 0

The page url is something like /people?search=name
while I used current_path method of capybara it returned /people only.

current_path.should == people_path(:search => 'name')

But it fails saying

expected: "/people?search=name"
got: "/people"

How we can make it pass? Is there is any way to do this?

  • 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-20T12:11:32+00:00Added an answer on May 20, 2026 at 12:11 pm

    I’ve updated this answer to reflect modern conventions in capybara. I think this is ideal since this is the accepted answer, and what many people are being referred to when looking for a solution. With that said, the correct way to check the current path is to use the has_current_path? matcher provided by Capybara, as documented here: Click Here

    Example usage:

    expect(page).to have_current_path(people_path(search: 'name'))
    

    As you can see in the documentation, other options are available. If the current page is /people?search=name but you only care that it’s on the /people page regardless of the param, you can send the only_path option:

    expect(page).to have_current_path(people_path, only_path: true)
    

    Additionally, if you want to compare the entire URL:

    expect(page).to have_current_path(people_url, url: true)
    

    Credit to Tom Walpole for pointing out this method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to rewrite search results page url to something like /search/query-1.html but when
I have a page that is accessed via a URL like this: http://power-coder.net/Test/something.php?id=3#Page1 I
Consider e.g. the following scenario: we give some entry point URL (something like https://our.server/customer-name/entry-point.js
My problem is that when people type in url something like home/DeleteSong?id=139 they are
I need to load the url something like https://m.ongein.nl in my web view and
To use flickr as an example, a request URL looks something like this: 'http://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key='
I have a url structure that looks something like some_page.php?id=123 and I get the
Test Page URL: http://www.guygar.com/inception/ultra/indexCopy.html I am new to this and searching SO I found
How to get previous page URL using jQuery? I am using the following code
How do we get the current page URL in Lift snippets? I am trying

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.