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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:03:41+00:00 2026-06-08T19:03:41+00:00

Im testing my app with rspec with the next simple code: require ‘spec_helper’ describe

  • 0

Im testing my app with rspec with the next simple code:

require 'spec_helper'

    describe CarsController do
    describe "GET 'new'" do
            it "should be successful" do
            visit new_user_car_path(:user_id=>"28")
            response.should be_success
            end
        end
    end

when I run it I got this message

Failure/Error: visit new_user_car_path(:user_id=>"28")
 ActiveRecord::RecordNotFound:
   Couldn't find User with id=28
 # ./app/controllers/cars_controller.rb:3:in `new'
 # ./spec/controllers/tanking_logs_controller_spec.rb:6:in `block (3 levels) in <top (required)>'

I don’t know whats happens with this, in my routes appears the new_user_car_path, look…

user_cars GET    /users/:user_id/cars(.:format)                               cars#index
                      POST   /users/:user_id/cars(.:format)                               cars#create
         new_user_car GET    /users/:user_id/cars/new(.:format)                           cars#new
        edit_user_car GET    /users/:user_id/cars/:id/edit(.:format)                      cars#edit
             user_car GET    /users/:user_id/cars/:id(.:format)                           cars#show
                      PUT    /users/:user_id/cars/:id(.:format)                           cars#update
                      DELETE /users/:user_id/cars/:id(.:format)                           cars#destroy

and this is my routes.rb if it needs

Estaciones::Application.routes.draw do
root :to => "static_pages#home"
match '/contact', :to=>'static_pages#contact'
match '/about', :to=>'static_pages#about'
devise_for :users
resources :gas_stations
   resources :users do
      resources :cars do
      #resources :tanking_logs
      end
   end
...
  • 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-08T19:03:42+00:00Added an answer on June 8, 2026 at 7:03 pm
    new_user_car GET    /users/:user_id/cars/new(.:format)
    

    Your path needs a :user_id param in order to work, and you’re not providing one.

    EDIT As per your comments, if you’re using Factory Girl Rails you can set up a factory to create users, and then do something like:

    user = Factory.create :user
    visit new_user_car_path(:id => user.id)
    

    Else, you can manually create them:

    user = User.create!(:name => "Joe", ...)
    visit new_user_car_path(:id => user.id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the rspec code for testing show in customers controller: it 'show' should
I am running a sinatra app and have a testing suite setup using rspec
Its a rails 2.3.5 app. I'm using the rspec and cucumber for testing. When
I am just testing an app to get data off our web server, previously
I'm writing a sinatra app and testing it with rspec and rack/test (as described
I'm adding more rspec testing to my app and would like to test a
I´m testing my rails app using rspec and remarkable. I have the following spec
I im creating a simple testing app that runs a check every hour on
I'm using rspec for testing w my rails 3 app. I need to seed
When I started my Rails app, I chose RSpec as my testing framework, because

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.