timpone
timpone

Reputation: 19939

rspec controller spec accessing route

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

Upvotes: 0

Views: 679

Answers (2)

Ismael
Ismael

Reputation: 16720

Just do get edit_location_path(37) ??

Upvotes: 1

Aaron Sumner
Aaron Sumner

Reputation: 226

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

Upvotes: 2

Related Questions