Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match_array + hash_including raises exception #132

Closed
dbackeus opened this issue May 19, 2021 · 4 comments
Closed

match_array + hash_including raises exception #132

dbackeus opened this issue May 19, 2021 · 4 comments
Labels

Comments

@dbackeus
Copy link

Eg.

  it "fails with super_diff" do
    expect([{"message" => "lol"}]).to match_array(
      hash_including("message" => "lol")
    )
  end

Results in:

NoMethodError:
  undefined method `size' for #<RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher:0x00007fd42da5e3e0>

Commenting out require "super_diff/rspec-rails" in my spec helper fixes the issue.

@nickstanish
Copy link

I found a workaround: add an array instead of using varargs

    expect([{"message" => "lol"}]).to match_array([
      hash_including("message" => "lol")
    ])

@djsmentya
Copy link

Hi @mcmire

Any reasons suggested PR by @wata727 was not merged? It looks like quite a valuable fix.

@afuno
Copy link

afuno commented Aug 8, 2023

Hi @mcmire

Is there a rough estimate for fixing this issue?

@dbackeus
Copy link
Author

dbackeus commented May 8, 2024

This issue was closed via #213

@dbackeus dbackeus closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants