class Pact::Provider::RSpec::Formatter2

Constants

C

Public Instance Methods

dump_commands_to_rerun_failed_examples() click to toggle source
# File lib/pact/provider/rspec/formatter_rspec_2.rb, line 18
def dump_commands_to_rerun_failed_examples
  return if failed_examples.empty?

  print_rerun_commands
  print_failure_message
  print_missing_provider_states

end

Private Instance Methods

executing_with_ruby?() click to toggle source
# File lib/pact/provider/rspec/formatter_rspec_2.rb, line 72
def executing_with_ruby?
  ENV['PACT_EXECUTING_LANGUAGE'] == 'ruby'
end
failure_message() click to toggle source
# File lib/pact/provider/rspec/formatter_rspec_2.rb, line 68
def failure_message
  "\n" + Pact::Provider::Help::PromptText.() + "\n"
end
interaction_rerun_command_for(example) click to toggle source
# File lib/pact/provider/rspec/formatter_rspec_2.rb, line 48
def interaction_rerun_command_for example
  example_description = example.metadata[:pact_interaction_example_description]
  if ENV['PACT_INTERACTION_RERUN_COMMAND']
    cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND'])
    provider_state = example.metadata[:pact_interaction].provider_state
    description = example.metadata[:pact_interaction].description
    pactfile_uri = example.metadata[:pactfile_uri]
    cmd.gsub!("<PACT_URI>", pactfile_uri.to_s)
    cmd.gsub!("<PACT_DESCRIPTION>", description)
    cmd.gsub!("<PACT_PROVIDER_STATE>", "#{provider_state}")
    failure_color(cmd) + " " + detail_color("# #{example_description}")
  else
    failure_color("* #{example_description}")
  end
end
interaction_rerun_commands() click to toggle source
# File lib/pact/provider/rspec/formatter_rspec_2.rb, line 42
def interaction_rerun_commands
  failed_examples.collect do |example|
    interaction_rerun_command_for example
  end.uniq
end
print_failure_message() click to toggle source
print_missing_provider_states() click to toggle source
print_rerun_commands() click to toggle source