Sha256: 2bb2075b616f1ab8404df9653c1a0b1d30a4eeb5b8ac42a8adfee3c029d278ee

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

require 'test_helper'

class PathsParamTest < Test::Unit::TestCase
  include Sprout::TestHelper

  context "a new PathsParam" do

    setup do
      @path1 = File.join(fixtures, 'executable', 'paths', 'folder1')
      @path2 = File.join(fixtures, 'executable', 'paths', 'folder2')
      @path3 = File.join(fixtures, 'executable', 'paths', 'folder3')

      @param = Sprout::Executable::Paths.new
      @param.belongs_to = FakeExecutableTask.new
      @param.name = 'paths'
    end

    should "accept a collection of paths" do
      @param.value << @path1
      @param.value << @path2
      @param.value << @path3

      as_each_system do |sys|
        assert_equal "-paths+=#{sys.clean_path(@path1)} -paths+=#{sys.clean_path(@path2)} -paths+=#{sys.clean_path(@path3)}", @param.to_shell
      end

      # All child files have been added as prerequisites:
      assert_equal 6, @param.belongs_to.prerequisites.size
    end

    should "accept a custom file expression" do
      @param.file_expression = "file2"
      @param.value << @path1

      as_each_system do |sys|
        assert_equal "-paths+=#{sys.clean_path(@path1)}", @param.to_shell
      end

      # All child files have been added as prerequisites:
      assert_equal 1, @param.belongs_to.prerequisites.size
    end

    should "accept hidden_name parameter" do
      @param.hidden_name = true
      @param.value << @path1
      assert_equal @path1, @param.to_shell
      # All child files have been added as prerequisites:
      assert_equal 3, @param.belongs_to.prerequisites.size
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sprout-1.1.18.pre test/unit/paths_param_test.rb
sprout-1.1.17.pre test/unit/paths_param_test.rb
sprout-1.1.16.pre test/unit/paths_param_test.rb
sprout-1.1.15.pre test/unit/paths_param_test.rb
sprout-1.1.14.pre test/unit/paths_param_test.rb
sprout-1.1.13.pre test/unit/paths_param_test.rb
sprout-1.1.11.pre test/unit/paths_param_test.rb
sprout-1.1.10.pre test/unit/paths_param_test.rb
sprout-1.1.7.pre test/unit/paths_param_test.rb
sprout-1.1.5.pre test/unit/paths_param_test.rb
sprout-1.1.4.pre test/unit/paths_param_test.rb
sprout-1.1.3.pre test/unit/paths_param_test.rb
sprout-1.1.2.pre test/unit/paths_param_test.rb