class Pact::Provider::Help::PactDiff

Attributes

output[R]
pact_source[R]

Public Class Methods

call(pact_source) click to toggle source
# File lib/pact/provider/help/pact_diff.rb, line 15
def self.call pact_source
  new(pact_source).call
end
new(pact_source) click to toggle source
# File lib/pact/provider/help/pact_diff.rb, line 11
def initialize pact_source
  @pact_source = pact_source
end

Public Instance Methods

call() click to toggle source
# File lib/pact/provider/help/pact_diff.rb, line 19
def call
  begin
    header + "\n" + get_diff
  rescue PrintPactDiffError => e
    return e.message
  end
end

Private Instance Methods

get_diff() click to toggle source
# File lib/pact/provider/help/pact_diff.rb, line 33
def get_diff
  begin
    pact_source.hal_entity._link!("pb:diff-previous-distinct").get!(nil, "Accept" => "text/plain").body
  rescue StandardError => e
    raise PrintPactDiffError.new("Tried to retrieve diff with previous pact, but received error #{e.class} #{e.message}.")
  end
end
header() click to toggle source
# File lib/pact/provider/help/pact_diff.rb, line 29
def header
  "The following changes have been made since the previous distinct version of this pact, and may be responsible for verification failure:\n"
end