rails/rails — Issue #4838: Testing nested resources don't route correctly
Author: newellista
Created: 2012-02-01 23:20:13+00:00
State: open

I have the following in my routes file:

```ruby
resources :accounts do
resources :contacts
end
```

In my spec/controllers/contacts_controller_spec.rb if have the following test:

```ruby
describe ContactsController do
describe "GET 'index'" do
it "has a 200 status code" do
get :index, account_id: 1, format: json
response.code.should eq('200')
end
end
end
```

This passes, as I'd expect. However, if I remove the account_id parameter like this:

```ruby
describe "GET 'index'" do
it "has a 200 status code" do
get :index, format: json
response.code.should eq('200')
end
end
```

it also passes. I would expect this to generate a routing error.