Sha256: ec0dfae8cb5f085587850a5d3c5d46be53b8eb854c2b8bc49bc9bf26786f9b18

Contents?: true

Size: 763 Bytes

Versions: 9

Compression:

Stored size: 763 Bytes

Contents

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

class 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

9 entries across 9 versions & 1 rubygems

Version Path
wolverine-0.3.5 test/wolverine/path_component_test.rb
wolverine-0.3.4 test/wolverine/path_component_test.rb
wolverine-0.3.3 test/wolverine/path_component_test.rb
wolverine-0.3.2 test/wolverine/path_component_test.rb
wolverine-0.3.1 test/wolverine/path_component_test.rb
wolverine-0.2.7 test/wolverine/path_component_test.rb
wolverine-0.2.6 test/wolverine/path_component_test.rb
wolverine-0.3.0 test/wolverine/path_component_test.rb
wolverine-0.2.5 test/wolverine/path_component_test.rb