Class: PactBroker::Verifications::PseudoBranchStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/verifications/pseudo_branch_status.rb

Instance Method Summary collapse

Constructor Details

#initialize(latest_pact, latest_verification) ⇒ PseudoBranchStatus

Returns a new instance of PseudoBranchStatus.



13
14
15
16
# File 'lib/pact_broker/verifications/pseudo_branch_status.rb', line 13

def initialize latest_pact, latest_verification
  @latest_pact = latest_pact
  @latest_verification = latest_verification
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/pact_broker/verifications/pseudo_branch_status.rb', line 18

def to_s
  to_sym.to_s
end

#to_symObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pact_broker/verifications/pseudo_branch_status.rb', line 22

def to_sym
  return :never unless latest_pact
  return :never unless ever_verified?
  if latest_verification_successful?
    if pact_changed_since_last_verification?
      :stale
    else
      :success
    end
  elsif latest_verification.failed_and_pact_pending?
    :failed_pending
  else
    :failed
  end
end