Class: SuperDiff::RSpec::OperationTreeBuilders::HashIncluding
- Inherits:
-
Basic::OperationTreeBuilders::Hash
- Object
- Core::AbstractOperationTreeBuilder
- Basic::OperationTreeBuilders::Hash
- SuperDiff::RSpec::OperationTreeBuilders::HashIncluding
- Includes:
- RSpec::Matchers::Composable
- Defined in:
- lib/super_diff/rspec/operation_tree_builders/hash_including.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(expected:, **rest) ⇒ HashIncluding
constructor
A new instance of HashIncluding.
Methods inherited from Core::AbstractOperationTreeBuilder
Constructor Details
#initialize(expected:, **rest) ⇒ HashIncluding
Returns a new instance of HashIncluding.
16 17 18 19 20 21 22 23 24 |
# File 'lib/super_diff/rspec/operation_tree_builders/hash_including.rb', line 16 def initialize(expected:, **rest) hash = if SuperDiff::RSpec.a_hash_including_something?(expected) expected.expecteds.first else expected.instance_variable_get(:@expected) end super(expected: hash, **rest) end |
Class Method Details
.applies_to?(expected, actual) ⇒ Boolean
9 10 11 12 13 14 |
# File 'lib/super_diff/rspec/operation_tree_builders/hash_including.rb', line 9 def self.applies_to?(expected, actual) ( SuperDiff::RSpec.a_hash_including_something?(expected) || SuperDiff::RSpec.hash_including_something?(expected) ) && actual.is_a?(::Hash) end |