require File.dirname(__FILE__) + '/../test_helper'

class ReportTest < Test::Unit::TestCase

  def setup
    full_path = "#{RAILS_ROOT}/public/reports/"
    @report_file = full_path + 'totals.csv'
    FileUtils.mkpath(full_path)
    FileUtils.touch(@report_file)
  end

  def teardown
    File.unlink(@report_file) if File.exist?(@report_file)
  end

  def test_write_report_first
    f = File.open(@report_file,"w")
    assert_not_nil f
    assert f.syswrite("test output"), "Couldn't write to file"
    assert File.exist?(@report_file)
  end

  def test_write_report_second
    f = File.open(@report_file,"w")
    assert f.syswrite("more test output..."), "Couldn't write to file"
  end
end