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.



10
11
12
13
14
# File 'lib/super_diff/rspec/operation_tree_builders/collection_including.rb', line 10

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
# 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) &&
    actual.is_a?(::Array)
end