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, **kwargs, &block) ⇒ Object

So consumer_version_tag_name can be accessed by method name



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

def method_missing(m, *args, **kwargs, &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)


211
212
213
# File 'lib/pact_broker/domain/verification.rb', line 211

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



22
23
24
25
# File 'lib/pact_broker/domain/verification.rb', line 22

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

#consumer_nameObject



187
188
189
# File 'lib/pact_broker/domain/verification.rb', line 187

def consumer_name
  consumer.name
end

#failed_and_pact_pending?Boolean

Returns:

  • (Boolean)


224
225
226
# File 'lib/pact_broker/domain/verification.rb', line 224

def failed_and_pact_pending?
  !success && pact_pending
end

#interactions_missing_test_resultsObject



207
208
209
# File 'lib/pact_broker/domain/verification.rb', line 207

def interactions_missing_test_results
  @interactions_missing_test_results ||= pact_content_with_test_results.interactions_missing_test_results
end

#latest_pact_publicationObject



203
204
205
# File 'lib/pact_broker/domain/verification.rb', line 203

def latest_pact_publication
  pact_version.latest_pact_publication
end

#pact_content_with_test_resultsObject



215
216
217
# File 'lib/pact_broker/domain/verification.rb', line 215

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)


220
221
222
# File 'lib/pact_broker/domain/verification.rb', line 220

def pact_pending?
  pact_pending
end

#pact_version_shaObject



183
184
185
# File 'lib/pact_broker/domain/verification.rb', line 183

def pact_version_sha
  pact_version.sha
end

#provider_nameObject



191
192
193
# File 'lib/pact_broker/domain/verification.rb', line 191

def provider_name
  provider.name
end

#provider_version_numberObject



195
196
197
# File 'lib/pact_broker/domain/verification.rb', line 195

def provider_version_number
  provider_version.number
end

#provider_version_tag_namesObject



199
200
201
# File 'lib/pact_broker/domain/verification.rb', line 199

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