Sha256: 979e344c4360ede86dfcce0e9c6c9a167e927c6ede4fb599ca0b0f4be6fe6ff8

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

require 'test_helper'

class TestToriBackendFileSystem < Test::Unit::TestCase
  class Uploader
    def path
      "test/tmp/uploader"
    end
  end

  setup do
    path = Pathname("test/tmp/tori/store")
    @filesystem = Tori::Backend::FileSystem.new(path)
  end

  teardown do
    FileUtils.rm_rf("test/tmp")
  end

  test "#initialize" do
    assert_instance_of Tori::Backend::FileSystem, @filesystem
    assert_raise(ArgumentError){ Tori::Backend::FileSystem.new }
  end

  test "#exist?" do
    assert { true == @filesystem.exist?(".") }
    assert { false == @filesystem.exist?("nothing_file") }
  end

  test "#read" do
    FileUtils.touch @filesystem.root.join("readfile")
    assert { "" == @filesystem.read("readfile") }
    File.unlink @filesystem.root.join("readfile")
    assert_raise(Errno::ENOENT){ @filesystem.read("nothing_file") }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tori-0.0.4 test/test_tori_backend_filesystem.rb
tori-0.0.3 test/test_tori_backend_filesystem.rb