Sha256: a20d8b79653aa73471a9fe7b0a233e00a0bb82189bfa08293ad2f3c317a33dd5

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. test_helper])) unless defined?(Juicer)

class TestListCommand < Test::Unit::TestCase

  def setup
    @io = StringIO.new
    @command = Juicer::Command::List.new(@io)
    Juicer::Test::FileSetup.new.create
  end

  def test_list_nothing
    assert_raise ArgumentError do
      @command.execute
    end

    assert_raise ArgumentError do
      @command.execute []
    end
  end

  def test_list_css_file
    @command.execute "test/data/a.css"

    msg = <<-STDOUT
Dependency chain for test/data/a.css:
  test/data/b.css
  test/data/a.css

    STDOUT

    assert_equal msg, @io.string
  end

  def test_list_js_file
    @command.execute "test/data/a.js"

    msg = <<-STDOUT
Dependency chain for test/data/a.js:
  test/data/b.js
  test/data/a.js

    STDOUT

    assert_equal msg, @io.string
  end

  def test_list_several_files
    @command.execute ["test/data/a.js", "test/data/b.js"]

    msg = <<-STDOUT
Dependency chain for test/data/a.js:
  test/data/b.js
  test/data/a.js

Dependency chain for test/data/b.js:
  test/data/a.js
  test/data/b.js

    STDOUT

    assert_equal msg, @io.string
  end

  def test_list_files_unable_to_guess_type
    assert_raise FileNotFoundError do
      @command.execute("test/data/*.txt")
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
cjohansen-juicer-0.2.4 test/juicer/command/test_list.rb
cjohansen-juicer-0.2.5 test/juicer/command/test_list.rb
juicer-0.2.6 test/juicer/command/test_list.rb
juicer-0.2.0 test/juicer/command/test_list.rb
juicer-0.2.4 test/juicer/command/test_list.rb
juicer-0.2.3 test/juicer/command/test_list.rb
juicer-0.2.1 test/juicer/command/test_list.rb
juicer-0.2.5 test/juicer/command/test_list.rb