Sha256: 1e6c4acdca27fbae4a8d5a78b6c4495903e54f917419504ad545acfb0cf255a3

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

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

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

class TestSourceStacked < MiniTest::Unit::TestCase

  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

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 test/webgen/source/test_stacked.rb
webgen-1.0.0.beta2 test/webgen/source/test_stacked.rb
webgen-1.0.0.beta1 test/webgen/source/test_stacked.rb