Sha256: dd35e91aecda79ec759a5deb2f4ef5dcbbdee409e6180a0f4a1804566371f141

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 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

2 entries across 2 versions & 1 rubygems

Version Path
extattr-0.1.1 rspecs/extattr.rb
extattr-0.1.1-x86-mingw32 rspecs/extattr.rb