Class: PactBroker::Domain::Verification

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/pact_broker/domain/verification.rb

Constant Summary collapse

TO_JSON =
lambda { | thing | Sequel.object_to_json(thing) }
FROM_JSON_WITH_SYMBOL_KEYS =
lambda { | json | JSON.parse(json, symbolize_names: true) }

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object

So consumer_version_tag_name can be accessed by method name



231
232
233
234
235
236
237
# File 'lib/pact_broker/domain/verification.rb', line 231

def method_missing(m, *args, &block)
  if values.key?(m) && args.size == 0
    values[m]
  else
    super
  end
end

Instance Method Details

#all_interactions_missing_test_results?Boolean

Returns:

  • (Boolean)


213
214
215
# File 'lib/pact_broker/domain/verification.rb', line 213

def all_interactions_missing_test_results?
  pact_content_with_test_results.interactions.count == pact_content_with_test_results.interactions_missing_test_results.count
end

#before_createObject



24
25
26
27
# File 'lib/pact_broker/domain/verification.rb', line 24

def before_create
  super
  self.execution_date ||= DateTime.now
end

#consumer_nameObject



189
190
191
# File 'lib/pact_broker/domain/verification.rb', line 189

def consumer_name
  consumer.name
end

#failed_and_pact_pending?Boolean

Returns:

  • (Boolean)


226
227
228
# File 'lib/pact_broker/domain/verification.rb', line 226

def failed_and_pact_pending?
  !success && pact_pending
end

#interactions_missing_test_resultsObject



209
210
211
# File 'lib/pact_broker/domain/verification.rb', line 209

def interactions_missing_test_results
  @interactions_missing_test_results ||= pact_content_with_test_results.interactions_missing_test_results
end

#latest_pact_publicationObject



205
206
207
# File 'lib/pact_broker/domain/verification.rb', line 205

def latest_pact_publication
  pact_version.latest_pact_publication
end

#pact_content_with_test_resultsObject



217
218
219
# File 'lib/pact_broker/domain/verification.rb', line 217

def pact_content_with_test_results
  @pact_content_with_test_results = PactBroker::Pacts::Content.from_json(pact_version.content).with_test_results(test_results)
end

#pact_pending?Boolean

Whether the pact content was pending at the time the verification was run

Returns:

  • (Boolean)


222
223
224
# File 'lib/pact_broker/domain/verification.rb', line 222

def pact_pending?
  pact_pending
end

#pact_version_shaObject



185
186
187
# File 'lib/pact_broker/domain/verification.rb', line 185

def pact_version_sha
  pact_version.sha
end

#provider_nameObject



193
194
195
# File 'lib/pact_broker/domain/verification.rb', line 193

def provider_name
  provider.name
end

#provider_version_numberObject



197
198
199
# File 'lib/pact_broker/domain/verification.rb', line 197

def provider_version_number
  provider_version.number
end

#provider_version_tag_namesObject



201
202
203
# File 'lib/pact_broker/domain/verification.rb', line 201

def provider_version_tag_names
  provider_version.tags.collect(&:name)
end