Sha256: 2f0d5d4eb4ccab87d9785b535106b6c5c48676f337d6c2eaa26c407abdd9bb05

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

require 'test_helper'

class TestToriDefine < Test::Unit::TestCase
  setup do
    @orig = Tori.config.filename_callback
    Tori.config.filename_callback = ->(model){
      model
    }
    Tori.config.backend = Tori::Backend::FileSystem.new Pathname("test").join("tmp")
  end

  teardown do
    Tori.config.filename_callback = @orig
    FileUtils.rm_rf("test/tmp")
  end

  class Dammy
    def path
      "path"
    end
  end

  test "#initialize" do
    assert_instance_of Tori::File, Tori::File.new(nil, nil)
  end

  test "#to_s" do
    assert { "test" == Tori::File.new("test", nil).to_s }
  end

  test "#exist?" do
    assert { true == Tori::File.new(__FILE__, nil).exist? }
    assert { false == Tori::File.new("nothing_file", nil).exist? }
  end

  test "#copy?" do
    assert { false == Tori::File.new(__FILE__, nil).copy? }
    assert { true == Tori::File.new(__FILE__, Dammy.new).copy? }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tori-0.0.3 test/test_tori_file.rb