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

MONGOID-5069: fix Mongoid::Matcher.extract_attribute() for numeric Hash keys inside expanded array #4969

Conversation

dalton-braze
Copy link
Contributor

Summary

Mongoid::Matcher.expand_attribute() did not correctly handle numeric hash keys inside expanded arrays. This PR provides the fix + test cases.

Test Output (No Changes)

% rake spec

  1) Matcher.extract_attribute traversal.yml numeric Hash key inside expanded array has the expected exists flag
     Failure/Error: actual[0].should == expected_exists
     
       expected: true
            got: false (using ==)
       Diff:
       @@ -1 +1 @@
       -true
       +false
                                                                                                                        
  2) Matcher.extract_attribute traversal.yml numeric Hash key inside expanded array has the expected value
     Failure/Error: actual[1].should == expected_value

       expected: [3]
            got: nil (using ==)
                                                                                                                                             
  3) Matcher.extract_attribute traversal.yml multiple numeric Hash keys inside expanded array has the expected exists flag
     Failure/Error: actual[0].should == expected_exists

       expected: true
            got: false (using ==)
       Diff:
       @@ -1 +1 @@
       -true
       +false
                                                                                                                                                 
  4) Matcher.extract_attribute traversal.yml multiple numeric Hash keys inside expanded array has the expected value
     Failure/Error: actual[1].should == expected_value
     
       expected: [5, 6]
            got: nil (using ==)

XYZ examples, 4 failures

Test Output (Fix Implemented)

XYZ examples, 0 failures

@dalton-braze dalton-braze changed the title Fix Mongoid::Matcher.extract_attribute() for numeric Hash keys inside expanded array MONGOID-5069: Fix Mongoid::Matcher.extract_attribute() for numeric Hash keys inside expanded array Mar 23, 2021
@dalton-braze dalton-braze changed the title MONGOID-5069: Fix Mongoid::Matcher.extract_attribute() for numeric Hash keys inside expanded array MONGOID-5069: fix Mongoid::Matcher.extract_attribute() for numeric Hash keys inside expanded array Mar 23, 2021
@alcaeus alcaeus requested a review from p-mongo March 24, 2021 10:07
@p-mongo
Copy link
Contributor

p-mongo commented Apr 9, 2021

This is fixed in #4980.

@p-mongo p-mongo closed this Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants