Sha256: 96187638528a48dce81af9af67c5203fbdc7cd8d36f3ff27da1061db58582fb8

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

#vim: set fileencoding:utf-8

require "tmpdir"
basedir = File.join(Dir.tmpdir, "ruby-extattr.test-work")
Dir.mkdir basedir unless File.directory? basedir
filepath = File.join(basedir, "file1")

require "extattr"

extdata = "abcdefg"

Dir.chdir basedir do
  describe "file" do
    file = nil
    before(:all) do
      file = File.open(filepath, "a")
    end

    it ".extattr_list" do
      file.extattr_list.should eq([])
    end

    after(:all) do
      file.close
      file = nil
    end
  end

  describe File do
    before(:all) do
      File.open(filepath, "a") {}
    end

    it ".extattr_list" do
      File.extattr_list(filepath).should eq([])
    end

    it ".extattr_set" do
      File.extattr_set(filepath, "ext1", extdata).should nil
    end

    it ".extattr_list ((2))" do
      File.extattr_list(filepath).should eq(["ext1"])
    end

    it ".extattr_get" do
      File.extattr_get(filepath, "ext1").should eq(extdata)
    end

    it ".extattr_delete" do
      File.extattr_delete(filepath, "ext1").should nil
    end

    it ".extattr_list ((3))" do
      File.extattr_list(filepath).should eq([])
    end

    after(:all) do
      File.unlink filepath
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
extattr-0.2-x86-mingw32 spec/extattr_spec.rb
extattr-0.2 spec/extattr_spec.rb
extattr-0.1.2 rspecs/extattr.rb
extattr-0.1.2-x86-mingw32 rspecs/extattr.rb