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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:42:24+00:00 2026-06-13T17:42:24+00:00

I tried testing routes and just copied the example from the rspec-rails documentation. describe

  • 0

I tried testing routes and just copied the example from the rspec-rails documentation.

describe "routing to profiles" do
  it "routes /profile/:username to profile#show for username" do
    expect(:get => "/profiles/jsmith").to route_to(
      :controller => "profiles",
      :action => "show",
      :username => "jsmith"
    )
  end
end

I got the following error when running RSpec:

Failures:

  1) routing to profiles routes /profile/:username to profile#show for username
     Failure/Error: expect(:get => "/profiles/jsmith").to route_to(
     ArgumentError:
       wrong number of arguments (1 for 0)
     # ./spec/routing/test_spec.rb:11:in `block (2 levels) in <top (required)>'

Finished in 0.001 seconds
1 example, 1 failure

What’s going wrong here?

Thanks for any help.

  • 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-13T17:42:25+00:00Added an answer on June 13, 2026 at 5:42 pm

    expect takes a block. This means use curly brackets:

    expect{ :get => "/profiles/jsmith" }.to route_to(
    

    Reference: RSpec Expectations 2.0

    I don’t think you need expect anyway. Code from Testing an RSpec controller action that can't be accessed directly

    describe "routing" do
      it "routes /auth/:provider/callback" do
        { :post => "/auth/twitter/callback" }.should route_to(
          :controller => "authentications",
          :action => "create",
          :provider => "twitter")
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A simple/newbie question. I create a branch from the master branch (say testing), tried
I using PHPUnit and Selenium Server to testing Yii Application, but whenever i tried
I am having issues with networking being very slow.. For testing purposes, I tried
tried uncommenting pam_limits.so from the pam.d directory but no luck. Basic PAM seems to
I tried testing things on a VPS, and came close to 10K requests per
Using Rails 3.0.7. I have a simple form which shows all records from one
I just moved to using Rails 3.0.3 on my Mac OS X. When i
Tried testing my ribbonwindow in windows 8 developer preview and found out that mostly
Newbie using mongo 2.0.1 32-bit on windows tried testing out shards as follows: (4)
My Django application sends out quite a bit of emails and I've tried testing

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.