Sha256: b290eabf216c4ee0e5089477ba7bda36a2aa098c8deb78e03b4e04df7c8529b4

Contents?: true

Size: 730 Bytes

Versions: 7

Compression:

Stored size: 730 Bytes

Contents

require_relative '../test_helper'

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

7 entries across 7 versions & 1 rubygems

Version Path
wolverine-0.2.2 test/wolverine/path_component_test.rb
wolverine-0.2.1 test/wolverine/path_component_test.rb
wolverine-0.2.0 test/wolverine/path_component_test.rb
wolverine-0.1.3 test/wolverine/path_component_test.rb
wolverine-0.1.2 test/wolverine/path_component_test.rb
wolverine-0.1.1 test/wolverine/path_component_test.rb
wolverine-0.1.0 test/wolverine/path_component_test.rb