class Dumper::Json

Public Instance Methods

dump!(location, status, tables) click to toggle source
# File lib/rspec/flaky/dumper/json.rb, line 7
def dump!(location, status, tables)
  tables.each do |table|
    json = JSON.pretty_generate(table.all.map(&:attributes))
    FileUtils.mkdir_p(dump_path(location, table)) unless File.exists?(dump_path(location, table))
    File.open("#{dump_path(location, table)}/#{status}.json", 'w') do |f|
      f.write(json)
    end
  end
end

Private Instance Methods

dump_path(location, table) click to toggle source
# File lib/rspec/flaky/dumper/json.rb, line 19
def dump_path location, table
  "tmp/flaky_tests/#{location}/#{table}"
end