Sha256: d502b60e3e1d3ac4c40a11c9ba386fa53f474fa867fe34b24af73723dab9bd47

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

require_relative "spec_helper_initializer"

describe "Shakapacker::CompilerStrategy" do
  describe "#from_config" do
    it "returns an instance of MtimeStrategy when compiler_strategy is set to mtime" do
      allow(Shakapacker.config).to receive(:compiler_strategy).and_return("mtime")

      expect(Shakapacker::CompilerStrategy.from_config).to be_an_instance_of(Shakapacker::MtimeStrategy)
    end

    it "returns an instance of DigestStrategy when compiler_strategy is set to digest" do
      allow(Shakapacker.config).to receive(:compiler_strategy).and_return("digest")

      expect(Shakapacker::CompilerStrategy.from_config).to be_an_instance_of(Shakapacker::DigestStrategy)
    end

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

      expect { Shakapacker::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.2.3 spec/shakapacker/compiler_strategy_spec.rb
shakapacker-7.3.0.beta.1 spec/shakapacker/compiler_strategy_spec.rb
shakapacker-7.2.2 spec/shakapacker/compiler_strategy_spec.rb
shakapacker-7.2.1 spec/shakapacker/compiler_strategy_spec.rb
shakapacker-7.2.0 spec/shakapacker/compiler_strategy_spec.rb
shakapacker-7.2.0.rc.0 spec/shakapacker/compiler_strategy_spec.rb
shakapacker-7.1.0 spec/shakapacker/compiler_strategy_spec.rb