Class: PactBroker::Pacts::Diff::DiffDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/pacts/diff.rb

Overview

The next pact version after the previous distinct version. Eg. v1 (previous distinct) -> pactContentA

v2 (next pact)         -> pactContentB
v3                     -> pactContentB
v4 (current)           -> pactContentB

If we are at v4, then the previous distinct pact version is v1, and the next pact after that is v2. The timestamps on v2 are the ones we want - that’s when the latest distinct version content was first created.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pact, previous_distinct_pact, next_pact, base_url) ⇒ DiffDecorator

Returns a new instance of DiffDecorator.



48
49
50
51
52
53
# File 'lib/pact_broker/pacts/diff.rb', line 48

def initialize pact, previous_distinct_pact, next_pact, base_url
  @pact = pact
  @previous_distinct_pact = previous_distinct_pact
  @next_pact = next_pact
  @base_url = base_url
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



46
47
48
# File 'lib/pact_broker/pacts/diff.rb', line 46

def base_url
  @base_url
end

#next_pactObject (readonly)

Returns the value of attribute next_pact.



46
47
48
# File 'lib/pact_broker/pacts/diff.rb', line 46

def next_pact
  @next_pact
end

#pactObject (readonly)

Returns the value of attribute pact.



46
47
48
# File 'lib/pact_broker/pacts/diff.rb', line 46

def pact
  @pact
end

#previous_distinct_pactObject (readonly)

Returns the value of attribute previous_distinct_pact.



46
47
48
# File 'lib/pact_broker/pacts/diff.rb', line 46

def previous_distinct_pact
  @previous_distinct_pact
end

Instance Method Details

#to_textObject



55
56
57
# File 'lib/pact_broker/pacts/diff.rb', line 55

def to_text
  header + "\n\n" + diff + "\n\n" + links
end