0

I have a location resource and access via:

http://localhost:3000/locations/37/edit

In my spec, I have:

it "should allows us to edit" do
  @u=User.find_by_email('[email protected]')
  session[:user_id][email protected]    
  get edit_location_path, {:id => '37'}

but get the following error:

Failures:

  1) LocationsController should allows us to edit
     Failure/Error: get edit_location_path, :id => '37'
     ActionController::RoutingError:
       No route matches {:action=>"edit", :controller=>"locations"}
     # ./spec/controllers/locations_controller_spec.rb:12:in `block (2 levels) in <top (required)>'

How would I specify the link to this resource?

thx

2
  • It looks like you're loosing the id in your route, it's not showing up in the route error (there should be a :id => '37' in there). Commented Aug 28, 2012 at 3:10
  • You might want to mock the Location model, and pass that to edit_location_path(location) Commented Aug 28, 2012 at 3:28

2 Answers 2

2

Assuming it's a controller spec describing LocationsController, you can access it with get :edit, :id => 37.

Sign up to request clarification or add additional context in comments.

Comments

1

Just do get edit_location_path(37) ??

1 Comment

thx, I had a syntax error on the response that was causing problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.