Class: RSpec::Terraform::Matchers::IncludeResourceChange
- Inherits:
-
Object
- Object
- RSpec::Terraform::Matchers::IncludeResourceChange
- Includes:
- Matchers::BuiltIn::CountExpectation
- Defined in:
- lib/rspec/terraform/matchers/include_resource_change.rb
Overview
rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(definition = {}) ⇒ IncludeResourceChange
constructor
A new instance of IncludeResourceChange.
- #matches?(plan) ⇒ Boolean
- #with_attribute_value(*args) ⇒ Object
Constructor Details
#initialize(definition = {}) ⇒ IncludeResourceChange
Returns a new instance of IncludeResourceChange.
20 21 22 23 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 20 def initialize(definition = {}) @definition = definition @attributes = [] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
18 19 20 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 18 def attributes @attributes end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
18 19 20 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 18 def definition @definition end |
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
18 19 20 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 18 def plan @plan end |
Instance Method Details
#failure_message ⇒ Object
46 47 48 49 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 46 def "\nexpected: #{positive_expected_line}" \ "\n got: #{positive_got_line}" end |
#matches?(plan) ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 25 def matches?(plan) @plan = plan matches = attribute_matches(plan) match_count = matches.count if has_expected_count? expected_count_matches?(match_count) else match_count.positive? end end |
#with_attribute_value(*args) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/rspec/terraform/matchers/include_resource_change.rb', line 37 def with_attribute_value(*args) stage, path, value = args.count == 3 ? args : [:after, *args] path = [path] if path.is_a?(Symbol) path = RubyTerraform::Models::Path.new(path) value = maybe_box_value(value) @attributes << { stage: stage, path: path, value: value } self end |