class ReqresRspec::Formatters::Base

Attributes

logger[R]
output_path[R]
records[R]

Public Class Methods

new(records) click to toggle source
# File lib/reqres_rspec/formatters/base.rb, line 4
def initialize(records)
  @records = records
  @output_path = ReqresRspec.configuration.output_path
  @logger = ReqresRspec.logger
end

Public Instance Methods

process() click to toggle source
# File lib/reqres_rspec/formatters/base.rb, line 11
def process
  cleanup
  write
end

Private Instance Methods

cleanup() click to toggle source
# File lib/reqres_rspec/formatters/base.rb, line 24
def cleanup
  unless Dir.exist?(output_path)
    FileUtils.mkdir_p(output_path)
    logger.info "#{output_path} was recreated"
  end
  FileUtils.rm_rf(Dir.glob("#{output_path}/#{cleanup_pattern}"), secure: true)
end
cleanup_pattern() click to toggle source
# File lib/reqres_rspec/formatters/base.rb, line 20
def cleanup_pattern
  '**/*'
end
write() click to toggle source
# File lib/reqres_rspec/formatters/base.rb, line 16
def write
  raise 'Not Implemented'
end