Sha256: 8c9b211eb660cc93aad7c9a4f765915e85e8273e65a41114609c7400f24c4b17

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require_relative "spec_helper_initializer"

describe "Webpacker::CompilerStrategy" do
  describe "#from_config" do
    it "returns and instance of MtimeStrategy when compiler_strategy is set to mtime" do
      allow(Webpacker.config).to receive(:compiler_strategy).and_return("mtime")
      expect(Webpacker::CompilerStrategy.from_config).to be_an_instance_of(Webpacker::MtimeStrategy)
    end

    it "returns and instance of DigestStrategy when compiler_strategy is set to digest" do
      allow(Webpacker.config).to receive(:compiler_strategy).and_return("digest")
      expect(Webpacker::CompilerStrategy.from_config).to be_an_instance_of(Webpacker::DigestStrategy)
    end

    it "raise exception for unknown compiler_strategy in the config file" do
      expected_error_message = "Unknown strategy 'other'. Available options are 'mtime' and 'digest'."
      allow(Webpacker.config).to receive(:compiler_strategy).and_return("other")

      expect { Webpacker::CompilerStrategy.from_config }.to raise_error(expected_error_message)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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