Sha256: d229c92f387b1fd740c125024a12775257aac2b7c278d25c5e485e9d2fcc92b6

Contents?: true

Size: 927 Bytes

Versions: 14

Compression:

Stored size: 927 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'minitest/autorun'
require 'webgen/source/stacked'

class TestSourceStacked < Minitest::Test

  class TestSource
    def initialize(paths); @paths = paths; end
    def paths; Set.new(@paths); end
  end

  def test_initialize
    source = Webgen::Source::Stacked.new(nil)
    assert_equal([], source.stack)
    source = Webgen::Source::Stacked.new(nil, {'/dir' => 6})
    assert_equal([['/dir', 6]], source.stack)
  end

  def test_paths
    path1 = MiniTest::Mock.new
    path1.expect(:mount_at, 'path1', ['/'])
    path1.expect(:hash, 'path1'.hash)
    path2 = MiniTest::Mock.new
    path2.expect(:mount_at, 'path2', ['/hallo/'])
    path2.expect(:hash, 'path2'.hash)

    source = Webgen::Source::Stacked.new(nil, '/' => TestSource.new([path1]), '/hallo/' => TestSource.new([path2]))
    assert_equal(Set.new(['path1', 'path2']), source.paths)

    path1.verify
    path2.verify
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
webgen-1.7.2 test/webgen/source/test_stacked.rb
webgen-1.7.1 test/webgen/source/test_stacked.rb
webgen-1.7.0 test/webgen/source/test_stacked.rb
webgen-1.6.0 test/webgen/source/test_stacked.rb
webgen-1.5.2 test/webgen/source/test_stacked.rb
webgen-1.5.1 test/webgen/source/test_stacked.rb
webgen-1.5.0 test/webgen/source/test_stacked.rb
webgen-1.4.1 test/webgen/source/test_stacked.rb
webgen-1.4.0 test/webgen/source/test_stacked.rb
webgen-1.3.0 test/webgen/source/test_stacked.rb
webgen-1.2.1 test/webgen/source/test_stacked.rb
webgen-1.2.0 test/webgen/source/test_stacked.rb
webgen-1.1.0 test/webgen/source/test_stacked.rb
webgen-1.0.0 test/webgen/source/test_stacked.rb