require 'cabinet'

describe Cabinet::Local do
  cl           = Cabinet::Local.new('/tmp')
  file_name    = 'cabinet.test'
  file_content = (0...50).map{('a'..'z').to_a[rand(26)]}.join

  it "should create file" do
    cl.put(file_name, file_content).should eql(file_content.length)
  end

  it "should confirm file exists" do
    cl.exists?(file_name).should eql(true)
  end
  
  it "should confirm file does not exist" do
    random_string = file_content
    cl.exists?(random_string).should eql(false)
  end

  it "should read file" do
    cl.get(file_name).should eql(file_content)
  end

  it "should list files" do
  end

  it "should not overwrite file" do
  end

  it "should overwrite file if :force => true" do
  end

  it "should gzip file" do
    gz_file_name = file_name + '.gz'
    cl.gzip(gz_file_name, file_content)
    Zlib::GzipReader.open("/tmp/#{gz_file_name}") {|gz| gz.read}.should eql(file_content)
    cl.delete(gz_file_name)
  end

  it "should delete file" do
    cl.delete(file_name)
    cl.exists?(file_name).should eql(false)
  end
end
require 'cabinet'

describe Cabinet::Local do
  cl           = Cabinet::Local.new('/tmp')
  file_name    = 'cabinet.test'
  file_content = (0...50).map{('a'..'z').to_a[rand(26)]}.join

  it "should create file" do
    cl.put(file_name, file_content).should == file_content.length
  end

  it "should confirm file exists" do
    cl.exists?(file_name).should == true
  end
  
  it "should confirm file does not exist" do
    random_string = file_content
    cl.exists?(random_string).should == false
  end

  it "should read file" do
    cl.get(file_name).should == file_content
  end

  it "should list files" do
  end

  it "should not overwrite file" do
  end

  it "should overwrite file if :force => true" do
  end

  it "should gzip file" do
    gz_file_name = file_name + '.gz'
    cl.gzip(gz_file_name, file_content)
    Zlib::GzipReader.open("/tmp/#{gz_file_name}") {|gz| gz.read}.should == file_content
    cl.delete(gz_file_name)
  end

  it "should delete file" do
    cl.delete(file_name)
    cl.exists?(file_name).should == false
  end
end
Use == instead of eql() in tests
Use == instead of eql() in tests
