Sha256: 136e1576ee0da8fd4bb5924e1634605df8c4ca8d691e3468d477c398fceb73ef

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

class LightningPathMapTest < Test::Unit::TestCase

  context "PathMap" do    
    def create_map(path_hash)
      Dir.stub!(:glob) { path_hash.values }
      @path_map = Lightning::PathMap.new('blah') 
    end
    
    test "creates basic map" do
      expected_map = {"path1"=>"/dir1/path1", "path2"=>"/dir1/path2"}
      create_map(expected_map)
      assert_equal expected_map, @path_map.map
    end
    
    test "ignores paths from Lightning.ignore_paths" do
      Lightning.stub!(:ignore_paths, :return=>['path1'])
      expected_map = {"path1"=>"/dir1/path1", "path2"=>"/dir1/path2"}
      create_map(expected_map)
      assert_equal expected_map.slice('path2'), @path_map.map
    end
    
    test "creates map with duplicates" do
      expected_map = {"path1//dir3"=>"/dir3/path1", "path2"=>"/dir1/path2", "path1//dir1"=>"/dir1/path1", "path1//dir2"=>"/dir2/path1"}
      create_map(expected_map)
      assert_equal expected_map, @path_map.map
    end    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cldwalker-lightning-0.1.2 test/lightning_path_map_test.rb