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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:26:56+00:00 2026-06-11T03:26:56+00:00

I am new to rails and I am writing some tests using Capybara and

  • 0

I am new to rails and I am writing some tests using Capybara and cucumber.

Scenario: Successful login
  Given a user "admin@adm.com" with password "admin123"
  And I am on the sign in page

Given /^I am on the sign in page$/ do |page_name|
  visit('/users/sign_in')
  save_and_open_page
end

I am having trouble figuring out a way to write a named path instead of the ‘/users/sign_in’ url.

How can I figure it out?

  • 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-06-11T03:26:57+00:00Added an answer on June 11, 2026 at 3:26 am

    The way to do this is,

    Go to the project root directory and run

    rake routes
    

    This will give a list of all the requests handled by rails as follows:

    new_user_session GET    /users/sign_in(.:format)        devise/sessions#new
        user_session POST   /users/sign_in(.:format)        devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)       devise/sessions#destroy
    

    So looking at the first column above, we see the “new_user_session”

    This can be written as new_user_session_path and placed in visit() as:

    visit(new_user_session_path)
    

    And (as far as I know) it works just fine 🙂

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

Sidebar

Related Questions

I'm retroactively writing some tests, using RSpec, for a Rails project. I'm using the
I am using cucumber and RSpec for my new ruby on rails application and
I am an experienced web developer, but new to rails. I am writing a
I am an experienced web developer, but new to rails. I am writing a
As a new comer to writing front-end views with Rails, I'm a bit confused
I'm new to rspec and fairly new to rails. When writing test cases for
I'm writing some Rails code for a partial view, and I want it to
I'm having some troubles writing a Rails app that organizes scientific papers. Each paper
I am using Ruby on Rails 3.0.7 Cucumber 1.0.1, and Oracle as the database.
I have an application with a bunch of cucumber tests, and I tried using

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.