Class: PactJUnitFormatter::PactExample

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_junit_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contractObject (readonly)

Returns the value of attribute contract.



97
98
99
# File 'lib/pact_junit_formatter.rb', line 97

def contract
  @contract
end

#exampleObject (readonly)

Returns the value of attribute example.



97
98
99
# File 'lib/pact_junit_formatter.rb', line 97

def example
  @example
end

#notificationObject (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

#classnameObject



124
125
126
# File 'lib/pact_junit_formatter.rb', line 124

def classname
  "#{package_name}.#{interaction_name}"
end

#consumer_nameObject



104
105
106
# File 'lib/pact_junit_formatter.rb', line 104

def consumer_name
  @contract['consumer']['name']
end

#descriptionObject



116
117
118
# File 'lib/pact_junit_formatter.rb', line 116

def description
  @example.full_description.match(/(returns\s+.+)\z/)[1]
end

#interaction_nameObject



112
113
114
# File 'lib/pact_junit_formatter.rb', line 112

def interaction_name
  @example.[:pact_interaction_example_description]
end

#package_nameObject



120
121
122
# File 'lib/pact_junit_formatter.rb', line 120

def package_name
  "#{consumer_name}-#{provider_name}"
end

#provider_nameObject



108
109
110
# File 'lib/pact_junit_formatter.rb', line 108

def provider_name
  @contract['provider']['name']
end

#run_timeObject



132
133
134
# File 'lib/pact_junit_formatter.rb', line 132

def run_time
  @example.execution_result.run_time
end

#started_atObject



136
137
138
# File 'lib/pact_junit_formatter.rb', line 136

def started_at
  @example.execution_result.started_at
end

#statusObject



128
129
130
# File 'lib/pact_junit_formatter.rb', line 128

def status
  @example.execution_result.status
end