Sha256: 3c4a8e14ffab3f929c837f8ddaa178e8ae844d527cec2ab0f811d65c8a3c13e1

Contents?: true

Size: 927 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
webgen-1.7.3 test/webgen/source/test_stacked.rb