Sha256: 772b4e13272efbc3e8236cd76b22044b63154e3f56b811f660e08d57d02bb6a3

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

require File.join(File.expand_path('../../test_helper', __FILE__))

module Wolverine
  class PathComponentTest < MiniTest::Unit::TestCase

    def root
      @root ||= Pathname.new('.')
    end

    def pc
      @pc ||= Wolverine::PathComponent.new(root)
    end
    
    def test_directory_caching
      pc.expects(:directory?).with(root + 'bar').returns(true)
      assert_equal pc.bar.object_id, pc.bar.object_id
    end

    def test_script_caching
      pc.expects(:directory?).with(root + 'bar').returns(false)
      pc.expects(:file?).with(root + 'bar.lua').returns(true)
      script = stub
      Wolverine::Script.expects(:new).once.returns(script)
      script.expects(:call).twice.returns(:success)

      assert_equal pc.bar, pc.bar
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wolverine-0.2.3 test/wolverine/path_component_test.rb