splitwise / super_diff

A more helpful way to view differences between complex data structures in RSpec.
https://splitwise.github.io/super_diff/
MIT License
977 stars 50 forks source link

undefined local variable or method failure_message_args_description #113

Closed olleolleolle closed 3 years ago

olleolleolle commented 3 years ago

Hi!

My Capybara matcher (have_text) ran into this, when superdiff was in the Gemfile:

     NameError:
       undefined local variable or method `failure_message_args_description' for #<RSpec::Matchers::BuiltIn::Has:0x00005612812d0cc8>
       Did you mean?  failure_message_expecting

The method is called in the monkey_patches.rb file in this project.

I expected to get a failure like this reported (which it does when I removed super_diff):

       expected `#<Capybara::Node::Simple tag="div" path="/html/body/div[1]">.has_content?("Receipt of co
llection")` to be truthy, got false

My Gemfile was using latest code in this repo:

GIT
  remote: https://github.com/mcmire/super_diff.git
  revision: 034c90225aeb59c10a7ee2898efedf8c4bc27e88
  specs:
    super_diff (0.5.2)
      attr_extras (>= 6.2.4)
      diff-lcs
      patience_diff

I searched in the rspec-expectations repo, too, and was unable to locate a method like that, by searching and looking. https://github.com/rspec/rspec-expectations

mcmire commented 3 years ago

Hmmm! I can't think of why exactly this is happening, but let me look into it and get back to you.

olleolleolle commented 3 years ago

Perhaps because a Capybara Base Matcher is not implementing all of the (private) interface?

https://github.com/teamcapybara/capybara/blob/8510765c68913ccd3ce8e4d89cefe514ee187087/lib/capybara/rspec/matchers/base.rb#L13

mcmire commented 3 years ago

@olleolleolle No... I think this might be happening due to a change to RSpec itself. failure_message_args_description is a private method in the Has matcher that seems to have been refactored out here and here. It looks like the way that arguments are displayed comes from here now. In fact, I just tried upgrading to RSpec 3.10 and re-running spec/integration/rspec/have_predicate_spec.rb locally and those tests fail. So... that's what's happening.

arturopie commented 3 years ago

I'm running into the same issue. Let me know if you need more info.

mcmire commented 3 years ago

I recently released 0.6.1 which contains a fix for this issue. So you shouldn't see this anymore, but if you do let me know!