Sha256: 515b88b74023490172128bd8e3a68834af79242dee12784ed48681f7646c5bef

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

require_relative "spec_helper_initializer"

describe "Shakapacker" do
  describe "#inline_css?" do
    let(:dev_server) { instance_double("Shakapacker::DevServer") }

    before :each do
      allow(dev_server).to receive(:host).and_return("localhost")
      allow(dev_server).to receive(:port).and_return("3035")
      allow(dev_server).to receive(:pretty?).and_return(false)
      allow(dev_server).to receive(:https?).and_return(true)
      allow(dev_server).to receive(:running?).and_return(true)
    end

    it "returns nil with disabled dev_server" do
      expect(Shakapacker.inlining_css?).to be nil
    end

    it "returns true with enabled hmr" do
      allow(dev_server).to receive(:hmr?).and_return(true)
      allow(dev_server).to receive(:inline_css?).and_return(true)

      allow(Shakapacker.instance).to receive(:dev_server).and_return(dev_server)

      expect(Shakapacker.inlining_css?).to be true
    end

    it "returns false with enabled hmr and explicitly setting inline_css to false" do
      allow(dev_server).to receive(:hmr?).and_return(true)
      allow(dev_server).to receive(:inline_css?).and_return(false)

      allow(Shakapacker.instance).to receive(:dev_server).and_return(dev_server)

      expect(Shakapacker.inlining_css?).to be false
    end
  end

  it "has app_autoload_paths cleanup" do
    expect($test_app_autoload_paths_in_initializer).to eq []
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shakapacker-7.0.3 spec/shakapacker/shakapacker_spec.rb
shakapacker-7.0.2 spec/shakapacker/shakapacker_spec.rb
shakapacker-7.0.1 spec/shakapacker/shakapacker_spec.rb
shakapacker-7.0.0 spec/shakapacker/shakapacker_spec.rb
shakapacker-7.0.0.rc.2 spec/shakapacker/shakapacker_spec.rb
shakapacker-7.0.0.rc.1 spec/shakapacker/shakapacker_spec.rb
shakapacker-7.0.0.rc.0 spec/webpacker_spec.rb