Class: AWSCDK::Assertions::MatchResult
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Assertions::MatchResult
- Defined in:
- assertions/match_result.rb
Overview
The result of Match.test().
Class Method Summary collapse
Instance Method Summary collapse
-
#compose(id, inner) ⇒ AWSCDK::Assertions::MatchResult
Compose the results of a previous match as a subtree.
-
#fail_cost ⇒ Numeric
The cost of the failures so far.
-
#fail_count ⇒ Numeric
The number of failures.
-
#finished ⇒ AWSCDK::Assertions::MatchResult
Prepare the result to be analyzed.
-
#has_failed ⇒ Boolean
Does the result contain any failures.
-
#initialize(target) ⇒ MatchResult
constructor
A new instance of MatchResult.
-
#is_success ⇒ Boolean
Whether the match is a success.
-
#push(matcher, path, message) ⇒ AWSCDK::Assertions::MatchResult
deprecated
Deprecated.
use recordFailure()
-
#record_capture(options) ⇒ void
Record a capture against in this match result.
-
#record_failure(failure) ⇒ AWSCDK::Assertions::MatchResult
Record a new failure into this result at a specific path.
-
#render_mismatch ⇒ String
Do a deep render of the match result, showing the structure mismatches in context.
-
#target ⇒ Object
The target for which this result was generated.
-
#to_human_strings ⇒ Array<String>
Render the failed match in a presentable way.
Constructor Details
#initialize(target) ⇒ MatchResult
Returns a new instance of MatchResult.
9 10 11 12 |
# File 'assertions/match_result.rb', line 9 def initialize(target) Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "target") Jsii::Object.instance_method(:initialize).bind(self).call(target) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'assertions/match_result.rb', line 14 def self.jsii_overridable_methods { :fail_cost => { kind: :property, name: "failCost", is_optional: false }, :fail_count => { kind: :property, name: "failCount", is_optional: false }, :is_success => { kind: :property, name: "isSuccess", is_optional: false }, :target => { kind: :property, name: "target", is_optional: false }, :compose => { kind: :method, name: "compose", is_optional: false }, :finished => { kind: :method, name: "finished", is_optional: false }, :has_failed => { kind: :method, name: "hasFailed", is_optional: false }, :push => { kind: :method, name: "push", is_optional: false }, :record_capture => { kind: :method, name: "recordCapture", is_optional: false }, :record_failure => { kind: :method, name: "recordFailure", is_optional: false }, :render_mismatch => { kind: :method, name: "renderMismatch", is_optional: false }, :to_human_strings => { kind: :method, name: "toHumanStrings", is_optional: false }, } end |
Instance Method Details
#compose(id, inner) ⇒ AWSCDK::Assertions::MatchResult
Compose the results of a previous match as a subtree.
64 65 66 67 68 |
# File 'assertions/match_result.rb', line 64 def compose(id, inner) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(inner, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoUmVzdWx0In0=")), "inner") jsii_call_method("compose", [id, inner]) end |
#fail_cost ⇒ Numeric
The cost of the failures so far.
34 35 36 |
# File 'assertions/match_result.rb', line 34 def fail_cost() jsii_get_property("failCost") end |
#fail_count ⇒ Numeric
The number of failures.
41 42 43 |
# File 'assertions/match_result.rb', line 41 def fail_count() jsii_get_property("failCount") end |
#finished ⇒ AWSCDK::Assertions::MatchResult
Prepare the result to be analyzed.
This API must be called prior to analyzing these results.
75 76 77 |
# File 'assertions/match_result.rb', line 75 def finished() jsii_call_method("finished", []) end |
#has_failed ⇒ Boolean
Does the result contain any failures.
If not, the result is a success
84 85 86 |
# File 'assertions/match_result.rb', line 84 def has_failed() jsii_call_method("hasFailed", []) end |
#is_success ⇒ Boolean
Whether the match is a success.
48 49 50 |
# File 'assertions/match_result.rb', line 48 def is_success() jsii_get_property("isSuccess") end |
#push(matcher, path, message) ⇒ AWSCDK::Assertions::MatchResult
use recordFailure()
DEPRECATED.
95 96 97 98 99 100 |
# File 'assertions/match_result.rb', line 95 def push(matcher, path, ) Jsii::Type.check_type(matcher, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoZXIifQ==")), "matcher") Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "path") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "message") jsii_call_method("push", [matcher, path, ]) end |
#record_capture(options) ⇒ void
This method returns an undefined value.
Record a capture against in this match result.
106 107 108 109 110 |
# File 'assertions/match_result.rb', line 106 def record_capture() = .is_a?(Hash) ? ::AWSCDK::Assertions::MatchCapture.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoQ2FwdHVyZSJ9")), "options") jsii_call_method("recordCapture", []) end |
#record_failure(failure) ⇒ AWSCDK::Assertions::MatchResult
Record a new failure into this result at a specific path.
116 117 118 119 120 |
# File 'assertions/match_result.rb', line 116 def record_failure(failure) failure = failure.is_a?(Hash) ? ::AWSCDK::Assertions::MatchFailure.new(**failure.transform_keys(&:to_sym)) : failure Jsii::Type.check_type(failure, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hc3NlcnRpb25zLk1hdGNoRmFpbHVyZSJ9")), "failure") jsii_call_method("recordFailure", [failure]) end |
#render_mismatch ⇒ String
Do a deep render of the match result, showing the structure mismatches in context.
125 126 127 |
# File 'assertions/match_result.rb', line 125 def render_mismatch() jsii_call_method("renderMismatch", []) end |
#target ⇒ Object
The target for which this result was generated.
55 56 57 |
# File 'assertions/match_result.rb', line 55 def target() jsii_get_property("target") end |
#to_human_strings ⇒ Array<String>
Render the failed match in a presentable way.
Prefer using render_mismatch over this method. It is left for backwards
compatibility for test suites that expect it, but render_mismatch() will
produce better output.
136 137 138 |
# File 'assertions/match_result.rb', line 136 def to_human_strings() jsii_call_method("toHumanStrings", []) end |