Closed wagenet closed 4 years ago
I'm using RSpec which uses diff-lcs for expect equal comparisons. In this case I'm doing the following comparison:
actual = {:category=>"app.rack.request"} expected = {:category=>"rack.middleware", :title=>"Anonymous Middleware"} expect(actual).to eq(expected)
The backtrace is this:
NoMethodError: undefined method `[]=' for nil:NilClass # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/diff-lcs-1.4/lib/diff/lcs/hunk.rb:167:in `block (2 levels) in unified_diff' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/diff-lcs-1.4/lib/diff/lcs/hunk.rb:164:in `each' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/diff-lcs-1.4/lib/diff/lcs/hunk.rb:164:in `block in unified_diff' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/diff-lcs-1.4/lib/diff/lcs/hunk.rb:163:in `each' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/diff-lcs-1.4/lib/diff/lcs/hunk.rb:163:in `unified_diff' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/diff-lcs-1.4/lib/diff/lcs/hunk.rb:106:in `diff' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-support-3.9.3/lib/rspec/support/differ.rb:49:in `diff_as_string' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-support-3.9.3/lib/rspec/support/differ.rb:60:in `diff_as_object' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-support-3.9.3/lib/rspec/support/differ.rb:20:in `diff' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/matchers/expecteds_for_multiple_diffs.rb:70:in `block in diffs' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/matchers/expecteds_for_multiple_diffs.rb:69:in `map' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/matchers/expecteds_for_multiple_diffs.rb:69:in `diffs' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/matchers/expecteds_for_multiple_diffs.rb:48:in `message_with_diff' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/expectations/fail_with.rb:33:in `fail_with' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:38:in `handle_failure' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:27:in `with_matcher' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb:48:in `handle_matcher' # /Users/peterwagenet/.rvm/gems/ruby-2.7.1/gems/rspec-expectations-3.9.2/lib/rspec/expectations/expectation_target.rb:65:in `to'
I’ll have 1.4.1 released soon that fixes this.
Released.
I'm using RSpec which uses diff-lcs for expect equal comparisons. In this case I'm doing the following comparison:
The backtrace is this: