collectiveidea / json_spec

Easily handle JSON in RSpec and Cucumber
rubygems.org/gems/json_spec
MIT License
919 stars 114 forks source link

MissingPathError causing spec failures when no #at_path specified #16

Closed wfarr closed 12 years ago

wfarr commented 12 years ago

Environment:

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")

Seems like some state is being kept around or being polluted unintentionally. This did not occur in RSpec 2.7.0 and only occurs with RSpec 2.8.x.

wfarr commented 12 years ago

This issue is caused by an issue with rspec-expectations: https://github.com/rspec/rspec-expectations/issues/105

Closing.