Sha256: 410b35de7fc3b615bafbdd3ce5ab5010da6477cf2ba41f0e7b7e7f950a640685

Contents?: true

Size: 1.5 KB

Versions: 22

Compression:

Stored size: 1.5 KB

Contents

require "test_helper"

class TestListCommand < Test::Unit::TestCase

  def setup
    @log = Juicer::LOGGER
    @command = Juicer::Command::List.new(@log)
    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
    result = @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, result
  end

  def test_list_js_file
    result = @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, result
  end

  def test_list_several_files
    result = @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, result
  end

  def test_list_several_files_with_empties
    result = @command.execute ["test/data/a.css", "test/data/b.css"]

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

Dependency chain for test/data/b.css:
  test/data/b.css
STDOUT

    assert_equal msg, result
  end

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

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
juicer-1.0.16 test/unit/juicer/command/list_test.rb
juicer-1.0.15 test/unit/juicer/command/list_test.rb
juicer-1.0.14 test/unit/juicer/command/list_test.rb
juicer-1.0.13 test/unit/juicer/command/list_test.rb
psyho_juicer-1.0.11 test/unit/juicer/command/list_test.rb
juicer-1.0.12 test/unit/juicer/command/list_test.rb
juicer-1.0.11 test/unit/juicer/command/list_test.rb
juicer-1.0.10 test/unit/juicer/command/list_test.rb
psyho_juicer-1.0.9 test/unit/juicer/command/list_test.rb
juicer-1.0.9 test/unit/juicer/command/list_test.rb
juicer-1.0.8 test/unit/juicer/command/list_test.rb
juicer-1.0.7 test/unit/juicer/command/list_test.rb
psyho_juicer-1.0.7 test/unit/juicer/command/list_test.rb
juicer-1.0.6 test/unit/juicer/command/list_test.rb
juicer-1.0.5 test/unit/juicer/command/list_test.rb
juicer-1.0.4 test/unit/juicer/command/list_test.rb
juicer-1.0.3 test/unit/juicer/command/list_test.rb
juicer-1.0.2 test/unit/juicer/command/list_test.rb
juicer-1.0.1 test/unit/juicer/command/list_test.rb
psyho_juicer-1.0.0 test/unit/juicer/command/list_test.rb