Class: PactJUnitFormatter::PactExample
- Inherits:
-
Object
- Object
- PactJUnitFormatter::PactExample
- Defined in:
- lib/pact_junit_formatter.rb
Instance Attribute Summary collapse
-
#contract ⇒ Object
readonly
Returns the value of attribute contract.
-
#example ⇒ Object
readonly
Returns the value of attribute example.
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
Instance Method Summary collapse
- #classname ⇒ Object
- #consumer_name ⇒ Object
- #description ⇒ Object
-
#initialize(notification) ⇒ PactExample
constructor
A new instance of PactExample.
- #interaction_name ⇒ Object
- #package_name ⇒ Object
- #provider_name ⇒ Object
- #run_time ⇒ Object
- #started_at ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(notification) ⇒ PactExample
Returns a new instance of PactExample.
98 99 100 101 102 |
# File 'lib/pact_junit_formatter.rb', line 98 def initialize(notification) @notification = notification @example = notification.example @contract = JSON.parse(example.[:pact_json]) end |
Instance Attribute Details
#contract ⇒ Object (readonly)
Returns the value of attribute contract.
97 98 99 |
# File 'lib/pact_junit_formatter.rb', line 97 def contract @contract end |
#example ⇒ Object (readonly)
Returns the value of attribute example.
97 98 99 |
# File 'lib/pact_junit_formatter.rb', line 97 def example @example end |
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
97 98 99 |
# File 'lib/pact_junit_formatter.rb', line 97 def notification @notification end |
Instance Method Details
#classname ⇒ Object
124 125 126 |
# File 'lib/pact_junit_formatter.rb', line 124 def classname "#{package_name}.#{interaction_name}" end |
#consumer_name ⇒ Object
104 105 106 |
# File 'lib/pact_junit_formatter.rb', line 104 def consumer_name @contract['consumer']['name'] end |
#description ⇒ Object
116 117 118 |
# File 'lib/pact_junit_formatter.rb', line 116 def description @example.full_description.match(/(returns\s+.+)\z/)[1] end |
#interaction_name ⇒ Object
112 113 114 |
# File 'lib/pact_junit_formatter.rb', line 112 def interaction_name @example.[:pact_interaction_example_description] end |
#package_name ⇒ Object
120 121 122 |
# File 'lib/pact_junit_formatter.rb', line 120 def package_name "#{consumer_name}-#{provider_name}" end |
#provider_name ⇒ Object
108 109 110 |
# File 'lib/pact_junit_formatter.rb', line 108 def provider_name @contract['provider']['name'] end |
#run_time ⇒ Object
132 133 134 |
# File 'lib/pact_junit_formatter.rb', line 132 def run_time @example.execution_result.run_time end |
#started_at ⇒ Object
136 137 138 |
# File 'lib/pact_junit_formatter.rb', line 136 def started_at @example.execution_result.started_at end |
#status ⇒ Object
128 129 130 |
# File 'lib/pact_junit_formatter.rb', line 128 def status @example.execution_result.status end |