Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4076

=== operator not working as expected on Mongoid::Relations::Many

    • Type: Icon: Task Task
    • Resolution: Done
    • 5.0.0
    • Affects Version/s: None
    • Component/s: None
    • None

      Let's say we have User model with has_many :devices relation.

      If val is set to user.devices, consider the following:

      [14] pry(#<RSpec::Matchers::BuiltIn::ChangeDetails>)> val.is_a? Enumerable
      => true
      [15] pry(#<RSpec::Matchers::BuiltIn::ChangeDetails>)> val.is_a? Array
      => true

      So far everything is good. But shouldn't the following tests also return true?

      [16] pry(#<RSpec::Matchers::BuiltIn::ChangeDetails>)> Array === val
      => false
      [17] pry(#<RSpec::Matchers::BuiltIn::ChangeDetails>)> Enumerable === val
      => false

      You can find full repro here (all tests should pass):
      https://github.com/knovoselic/rspec-expectations-change-bug-repro

      I thought this was an rspec-expectations issue, but it turns out it's Mongoid issue. Please see this for more details:
      https://github.com/rspec/rspec-expectations/issues/791

            Assignee:
            Unassigned Unassigned
            Reporter:
            knovoselic knovoselic
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: