class SuperDiff::RSpec::OperationTreeBuilders::CollectionIncluding

Public Class Methods

applies_to?(expected, actual) click to toggle source
# File lib/super_diff/rspec/operation_tree_builders/collection_including.rb, line 5
def self.applies_to?(expected, actual)
  (
    SuperDiff::RSpec.a_collection_including_something?(expected) ||
    SuperDiff::RSpec.array_including_something?(expected)
  ) && actual.is_a?(::Array)
end
new(expected:, actual:, **rest) click to toggle source
Calls superclass method
# File lib/super_diff/rspec/operation_tree_builders/collection_including.rb, line 12
def initialize(expected:, actual:, **rest)
  super

  @expected = actual_with_extra_items_in_expected_at_end
end

Private Instance Methods

actual_with_extra_items_in_expected_at_end() click to toggle source
# File lib/super_diff/rspec/operation_tree_builders/collection_including.rb, line 20
def actual_with_extra_items_in_expected_at_end
  value = if SuperDiff::RSpec.a_collection_including_something?(expected)
            expected.expecteds
          else
            expected.instance_variable_get(:@expected)
          end
  actual + (value - actual)
end