Sha256: ec02574c7c4200a1711874588a0ed9c18999389cb1247df3ec7436974ea995e8

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

require 'helper'

class TestRootPath < FunWith::Files::TestCase
  should "add a root to a module" do
    mod = Module.new
    path = File.join("/", "usr", "bin")
    rootify_and_test( mod, path )
  end
  
  should "add a root to an object" do
    obj = Object.new
    path = File.join("/", "usr", "bin")
    rootify_and_test( obj, path )
  end
  
  context "FunWith::Files.root" do
    should "be a directory" do
      assert_directory( FunWith::Files.root )
      assert_empty_directory( FunWith::Files.root( :test, :tmp ) )
      assert_empty_directory( FunWith::Files.root / :test / :tmp )
      assert_empty_directory( FunWith::Files.root / "test" / "tmp" )
    end
  end
  
  def rootify_and_test( obj, path )
    RootPath.rootify( obj, path )
    assert obj.respond_to?(:root)
    assert obj.respond_to?(:set_root_path)
    assert_equal path, obj.root.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fun_with_files-0.0.18 ./test/test_root_path.rb