r7kamura / rspec-json_matcher

RSpec matcher for testing JSON string
MIT License
171 stars 10 forks source link

Not compatible with Rails 4.1 #4

Closed shin1ohno closed 3 years ago

shin1ohno commented 10 years ago

Unless Gemfile has gem 'multi-json', upgrading to Rails 4.1 breaks be_json matcher.

We need a fix in a few weeks or month.

  1) ApplicationController GET /dummy_me should be json {:user_id=>1}
     Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `json?' for "{\"user_id\":1}":String
     # ./tmp/bundler/ruby/2.1.0/bundler/gems/rspec-expectations-3c4b42a69dce/lib/rspec/matchers/built_in/be.rb:146:in `matches?'
     # ./tmp/bundler/ruby/2.1.0/bundler/gems/rspec-expectations-3c4b42a69dce/lib/rspec/expectations/handler.rb:49:in `handle_matcher'
     # ./tmp/bundler/ruby/2.1.0/bundler/gems/rspec-expectations-3c4b42a69dce/lib/rspec/expectations/expectation_target.rb:29:in `to'
     # spec/requests/authentication_spec.rb:27:in `block (3 levels) in <top (required)>'
PikachuEXE commented 9 years ago

Not sure why be_json is not called, but it a matcher provided by the gem Maybe file not required properly?