Class: SuperDiff::RSpec::OperationTreeBuilders::CollectionIncluding

Inherits:
Basic::OperationTreeBuilders::Array show all
Defined in:
lib/super_diff/rspec/operation_tree_builders/collection_including.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Basic::OperationTreeBuilders::Array

#call, #operation_tree

Methods inherited from Core::AbstractOperationTreeBuilder

#call

Constructor Details

#initialize(expected:, actual:, **rest) ⇒ CollectionIncluding

Returns a new instance of CollectionIncluding.



14
15
16
17
18
# File 'lib/super_diff/rspec/operation_tree_builders/collection_including.rb', line 14

def initialize(expected:, actual:, **rest)
  super

  @expected = actual_with_extra_items_in_expected_at_end
end

Class Method Details

.applies_to?(expected, actual) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'lib/super_diff/rspec/operation_tree_builders/collection_including.rb', line 7

def self.applies_to?(expected, actual)
  (
    SuperDiff::RSpec.a_collection_including_something?(expected) ||
      SuperDiff::RSpec.array_including_something?(expected)
  ) && actual.is_a?(::Array)
end