Sha256: b9d518dbb1c29f2097cb8675802ad573151b8f7a4a108d7ce1ae3f11158d10b4

Contents?: true

Size: 809 Bytes

Versions: 9

Compression:

Stored size: 809 Bytes

Contents

require "test_helper"

class DigestStrategyTest < Minitest::Test
  def remove_compilation_digest_path
    @digest_strategy.send(:compilation_digest_path).tap do |path|
      path.delete if path.exist?
    end
  end

  def setup
    @digest_strategy = Webpacker::DigestStrategy.new
    remove_compilation_digest_path
  end

  def teardown
    remove_compilation_digest_path
  end

  def test_freshness
    assert @digest_strategy.stale?
    assert !@digest_strategy.fresh?
  end

  def test_freshness_after_compilation_hook
    @digest_strategy.after_compile_hook
    assert @digest_strategy.fresh?
    assert !@digest_strategy.stale?
  end

  def test_compilation_digest_path
    assert_equal @digest_strategy.send(:compilation_digest_path).basename.to_s, "last-compilation-digest-#{Webpacker.env}"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
shakapacker-6.5.5 test/digest_strategy_test.rb
shakapacker-6.5.4 test/digest_strategy_test.rb
shakapacker-6.5.3 test/digest_strategy_test.rb
shakapacker-6.5.2 test/digest_strategy_test.rb
shakapacker-6.5.1 test/digest_strategy_test.rb
shakapacker-6.5.0 test/digest_strategy_test.rb
shakapacker-6.4.1 test/digest_strategy_test.rb
shakapacker-6.4.0 test/digest_strategy_test.rb
shakapacker-6.3.0 test/digest_strategy_test.rb