Sha256: c5a3f60c2e187e5453a34954f73f24e45ec1697e19fb1440f31b39e95304c43c

Contents?: true

Size: 966 Bytes

Versions: 7

Compression:

Stored size: 966 Bytes

Contents

require_relative "spec_helper_initializer"

describe "DigestStrategy" do
  def remove_compilation_digest_path
    @digest_strategy.send(:compilation_digest_path).tap do |path|
      path.delete if path.exist?
    end
  end

  before :all do
    @digest_strategy = Webpacker::DigestStrategy.new
    remove_compilation_digest_path
  end

  after :all do
    remove_compilation_digest_path
  end

  it "is not fresh before compilation" do
    expect(@digest_strategy.stale?).to be true
    expect(@digest_strategy.fresh?).to be_falsy
  end

  it "is fresh after compilation" do
    @digest_strategy.after_compile_hook
    expect(@digest_strategy.stale?).to be false
    expect(@digest_strategy.fresh?).to be true
  end

  it "generates correct compilation_digest_path" do
    actual_path = @digest_strategy.send(:compilation_digest_path).basename.to_s
    expected_path = "last-compilation-digest-#{Webpacker.env}"
    expect(actual_path).to eq expected_path
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shakapacker-7.0.3 spec/backward_compatibility_specs/digest_strategy_spec.rb
shakapacker-7.0.2 spec/backward_compatibility_specs/digest_strategy_spec.rb
shakapacker-7.0.1 spec/backward_compatibility_specs/digest_strategy_spec.rb
shakapacker-7.0.0 spec/backward_compatibility_specs/digest_strategy_spec.rb
shakapacker-7.0.0.rc.2 spec/backward_compatibility_specs/digest_strategy_spec.rb
shakapacker-7.0.0.rc.1 spec/backward_compatibility_specs/digest_strategy_spec.rb
shakapacker-7.0.0.rc.0 spec/backward_compatibility_specs/digest_strategy_spec_bc.rb