class RainforestCli::TestParser::Step

Constants

UPLOADABLE_REGEX

Public Instance Methods

has_uploadable_files?() click to toggle source
# File lib/rainforest_cli/test_parser/step.rb, line 13
def has_uploadable_files?
  uploadable_in_action.any? || uploadable_in_response.any?
end
to_s() click to toggle source
# File lib/rainforest_cli/test_parser/step.rb, line 9
def to_s
  "#{action} --> #{response}"
end
type() click to toggle source
# File lib/rainforest_cli/test_parser/step.rb, line 5
def type
  :step
end
uploadable_in_action() click to toggle source
# File lib/rainforest_cli/test_parser/step.rb, line 17
def uploadable_in_action
  action.scan(UPLOADABLE_REGEX).select do |match|
    needs_parameterization?(match)
  end
end
uploadable_in_response() click to toggle source
# File lib/rainforest_cli/test_parser/step.rb, line 23
def uploadable_in_response
  response.scan(UPLOADABLE_REGEX).select do |match|
    needs_parameterization?(match)
  end
end

Private Instance Methods

needs_parameterization?(match) click to toggle source
# File lib/rainforest_cli/test_parser/step.rb, line 31
def needs_parameterization?(match)
  argument = match[1]
  parameters = argument.split(',').map(&:strip)
  if parameters.length >= 2
    has_file_id = parameters[0].to_i > 0
    has_file_sig = parameters[1].length == 6
    !(has_file_id && has_file_sig)
  else
    true
  end
end