collectiveidea/json_spec — Issue #16: MissingPathError causing spec failures when no #at_path specified
Author: wfarr
Created: 2012-01-06 16:39:51+00:00
State: open

Environment:

* Rails 3.0.10
* RSpec-Rails 2.8.1
* json_spec 0.7.0

Given a controller spec with an example like so, where user and file exist via factories:

```
get :authorization_path,
:user_email => user.email,
:type => file.type,
:id => file.id,
:format => :json

response.body.should be_json_eql(true)
```

We began receiving MissingPathErrors for "2/discussions_post/id".

The only way to fix this, was to add an `#at_path("")` call to the end of every spec that didn't already specify an exact `#at_path`.

There is only one place this path is ever used, which is in an entirely different controller spec that contains an example like so:

```
get :some_posts, :format => :json

...

response.body.should be_json_eql(post.id).at_path("2/discussions_post/id")
```