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

Inherits:
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 OperationTreeBuilders::Array

#call, #operation_tree

Methods inherited from OperationTreeBuilders::Base

#call

Constructor Details

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

Returns a new instance of CollectionIncluding.



12
13
14
15
16
# 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

Class Method Details

.applies_to?(expected, actual) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
# 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