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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:53:49+00:00 2026-06-17T16:53:49+00:00

I am testing simple get requests for my routes using rspec in my Rails

  • 0

I am testing simple get requests for my routes using rspec in my Rails 3.2 application. Since all are get requests, and all just have different action names which are similar to the views’ names, it would be really repetitive to manually write a different test for each get request.

Instead, I wanted to come up with something like this:

%(action_1 action_2 action_3 action_4).each do |action|
    it "routes to the #{action} page" do
        get("liver_diseases#{action}_path").should route_to("liver_diseases##{action}")
    end
end

It fails at this pseudocode: get("liver_diseases_#{action}_path")
So what I need to do is a dynamic method call – but for what I have found out, that would involve .send(:method_name), for which I need to know the class name. And I couldn’t find that.

What do I need to do for this method call to work?

  • 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-17T16:53:49+00:00Added an answer on June 17, 2026 at 4:53 pm

    that would involve .send(:method_name), for which I need to know the
    class name

    When the receiver is missing, it’s always self. In the context of a controller example, self should be a controller instance. So you should be able to get that path with:

    send "liver_diseases_#{action}_path"
    

    which should be equivalent to:

    controller.send "liver_diseases_#{action}_path"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed VS2010 and MVC2 and testing a simple form using tinyMCE. When
I have a very simple .net application for testing SMTP on .net. But i
I have a very simple module I'm testing with Ruby using the VCR gem.
When I'm testing my simple geometric library, I usually have one or two methods
I'm just testing a simple databind expression with: <div> Now: <%# DateTime.Now.ToString()%> </div> According
testing Play framework and JPA. I eclipsify my very simple test application. Import the
I am developing a simple application using the current latest versions of nodejs +
I have a simple Gadget which shows weather details. I am using this google
Testing out Web API for file uploading, have a simple view model like this:
I have a simple website I'm testing. It's running on localhost and I can

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.