class ATMFormatter::BaseFormatter

Constants

DEFAULT_OPTIONS
NOTIFICATIONS

Public Instance Methods

start(_notification) click to toggle source
# File lib/atm_formatter/helpers/base_formatter.rb, line 8
def start(_notification)
  @options = DEFAULT_OPTIONS.merge(ATMFormatter.config.create_test_formatter_options)
  @client = ATM::Client.new(ATMFormatter.config.to_hash)
end

Private Instance Methods

configure_project_key() click to toggle source
# File lib/atm_formatter/helpers/base_formatter.rb, line 31
def configure_project_key
  self.class.to_s == 'ATMUpdateTestFormatter' ? nil : ATMFormatter.config.project_id
end
process_example(example) click to toggle source
# File lib/atm_formatter/helpers/base_formatter.rb, line 15
def process_example(example)
  {
      "projectKey":   configure_project_key,
      "name":         example.metadata[:full_description],
      "objective":    example.metadata[:objective],
      "precondition": example.metadata[:precondition],
      "folder":       example.metadata[:folder],
      "status":       example.metadata[:status],
      "priority":     example.metadata[:priority],
      "owner":        @options[:test_owner],
      "labels":       @options[:custom_labels],
      "testScript":   process_steps(example.metadata[:steps])
  }.delete_if { |k, v| v.nil? || v.empty?}
end
process_steps(example) click to toggle source
# File lib/atm_formatter/helpers/base_formatter.rb, line 35
def process_steps(example)
  return unless example
  arr = []
  example.each { |s| arr << {"description": s[:step_name]} }
  {
      "type": "STEP_BY_STEP",
      "steps": arr
  }
end