Method: CampfireExport::IO#verify_export

Defined in:
lib/campfire_export.rb

#verify_export(filename, expected_size) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/campfire_export.rb', line 81

def verify_export(filename, expected_size)
  full_path = "#{export_dir}/#{filename}"
  unless File.exists?(full_path)
    raise CampfireExport::Exception.new(full_path, 
      "file should have been exported but did not make it to disk")
  end
  unless File.size(full_path) == expected_size
    raise CampfireExport::Exception.new(full_path, 
      "exported file exists but is not the right size " +
      "(expected: #{expected_size}, actual: #{File.size(full_path)})")
  end
end