Sha256: 1679561e65afbed4314d6eb320f8857bf30bd5535d44f9ca8def2651ff63d496

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require "test_helper"

class SecretaryTest < Test::Unit::TestCase
  def test_load_locations_are_not_expanded_when_expand_paths_is_false
    secretary = Sprockets::Secretary.new(:root => FIXTURES_PATH)
    secretary.add_load_locations("src/**/", :expand_paths => false)
    
    assert_equal [File.join(FIXTURES_PATH, "src/**"), FIXTURES_PATH], 
                 secretary.environment.load_path.map { |pathname| pathname.absolute_location }
  end
  
  def test_load_locations_are_expanded_when_expand_paths_is_true
    secretary = Sprockets::Secretary.new(:root => FIXTURES_PATH)
    secretary.add_load_locations("src/**/", :expand_paths => true)
    
    assert_equal [File.join(FIXTURES_PATH, "src", "foo"), File.join(FIXTURES_PATH, "src"), FIXTURES_PATH],
                 secretary.environment.load_path.map { |pathname| pathname.absolute_location }
  end
  
  def test_source_files_are_not_expanded_when_expand_paths_is_false
    secretary = Sprockets::Secretary.new(:root => FIXTURES_PATH)
    assert_raises(Sprockets::LoadError) do
      secretary.add_source_files("src/f*.js", :expand_paths => false)
    end
  end
  
  def test_source_files_are_expanded_when_expand_paths_is_true
    secretary = Sprockets::Secretary.new(:root => FIXTURES_PATH)
    secretary.add_source_files("src/f*.js", :expand_paths => true)
    
    assert_equal [File.join(FIXTURES_PATH, "src", "foo.js")],
                 secretary.preprocessor.source_files.map { |source_file| source_file.pathname.absolute_location }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sstephenson-sprockets-0.4.0 test/test_secretary.rb