waterlink / rspec-json_expectations

Set of matchers and helpers to allow you test your APIs responses like a pro.
https://www.relishapp.com/waterlink/rspec-json-expectations/docs
MIT License
140 stars 23 forks source link

RSpec crashes when using `match` or `kind_of` #27

Open JanStevens opened 7 years ago

JanStevens commented 7 years ago

Probably messed something up in #19. My specs crash when I use match or kind_of in the value of the json, example:

expect(response.body).to include_json({
  resource: {
    version_number: (match(/1.1.[\d]+.event/)),
    checksum: a_kind_of(String)
  }
})
/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:151:in `block in failure_lines': undefined method `empty?' for nil:NilClass (NoMethodError)
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:147:in `tap'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:147:in `failure_lines'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:32:in `colorized_message_lines'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:238:in `formatted_message_and_backtrace'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:84:in `fully_formatted_lines'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:348:in `block (2 levels) in sub_failure_list_formatter'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/flat_map.rb:7:in `each'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/flat_map.rb:7:in `each_with_index'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/flat_map.rb:7:in `each'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/flat_map.rb:7:in `flat_map'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/flat_map.rb:7:in `flat_map'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:337:in `block in sub_failure_list_formatter'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:85:in `fully_formatted_lines'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/formatters/exception_presenter.rb:76:in `fully_formatted'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/notifications.rb:199:in `fully_formatted'
        from /lib/ruby/gems/2.3.0/gems/fuubar-2.2.0/lib/fuubar.rb:71:in `example_failed'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:201:in `block in notify'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:200:in `each'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:200:in `notify'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:140:in `example_failed'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:469:in `finish'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:428:in `fail_with_exception'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:596:in `block in run'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:637:in `each'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:637:in `for_filtered_examples'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:641:in `block in for_filtered_examples'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:639:in `each'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:639:in `for_filtered_examples'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:596:in `rescue in run'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:602:in `run'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `block (3 levels) in run_specs'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `map'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `block (2 levels) in run_specs'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1835:in `with_suite_hooks'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:112:in `block in run_specs'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:77:in `report'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:111:in `run_specs'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:87:in `run'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
        from /lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
        from /lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
        from /lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
        from /lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
        from /lib/ruby/gems/2.3.0/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call'
        from /lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from -e:1:in `<main>'