Sha256: 599146da2707d834bf262a7625d516b9077b5f3041ba7caf8c663f1bc35c3a30

Contents?: true

Size: 940 Bytes

Versions: 41

Compression:

Stored size: 940 Bytes

Contents

require "test_helper"

class CommandTest < Minitest::Test
  def test_compile_command_returns_success_status_when_stale
    Webpacker.compiler.stub :stale?, true do
      Webpacker.compiler.stub :run_webpack, true do
        assert_equal true, Webpacker.commands.compile
      end
    end
  end

  def test_compile_command_returns_success_status_when_fresh
    Webpacker.compiler.stub :stale?, false do
      Webpacker.compiler.stub :run_webpack, true do
        assert_equal true, Webpacker.commands.compile
      end
    end
  end

  def test_compile_command_returns_failure_status_when_stale
    Webpacker.compiler.stub :stale?, true do
      Webpacker.compiler.stub :run_webpack, false do
        assert_equal false, Webpacker.commands.compile
      end
    end
  end

  def test_clean_command_works_with_nested_hashes_and_without_any_compiled_files
    File.stub :delete, true do
      assert Webpacker.commands.clean
    end
  end
end

Version data entries

41 entries across 41 versions & 3 rubygems

Version Path
webpacker-4.1.0 test/command_test.rb