Sha256: 800bd57e47e0b635dda6f2d41a583ed5f62715f1a026e301f6f7ae4bc6d1d562

Contents?: true

Size: 1.24 KB

Versions: 21

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

require_relative '../../../lib/locomotive/steam/initializers/sprockets'

describe Locomotive::Steam::SprocketsEnvironment do

  let(:root)    { '.' }
  let(:options) { { minify: true } }
  let(:env)     { described_class.new(root, options) }

  describe '#install_autoprefixer' do

    let(:options) { { minify: false } }

    subject { env }

    context "config/autoprefixer.yml doesn't exist" do

      before { allow(File).to receive(:exists?).and_return false }

      it { expect(AutoprefixerRails).not_to receive(:install); subject }

    end

    context "config/autoprefixer.yml exists" do

      before {
        allow(File).to receive(:exists?).and_return(true)
        allow(YAML).to receive(:load_file).and_return({})
      }

      it { expect(AutoprefixerRails).to receive(:install).and_return(true); subject }

      it 'warns developers if they notice bad performance when using autoprefixer' do
        curent_execjs_runtime = ENV['EXECJS_RUNTIME']
        ENV['EXECJS_RUNTIME'] = 'NodeJS'
        expect(Locomotive::Common::Logger).not_to receive(:warn)
        expect(AutoprefixerRails).to receive(:install).and_return(true)
        subject
        ENV['EXECJS_RUNTIME'] = curent_execjs_runtime
      end

    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
locomotivecms_steam-1.6.1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.6.0 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.6.0.rc1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.6.0.beta1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.3 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.2 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.0 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.0.rc1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.0.rc0 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.0.beta3 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.0.beta2 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.5.0.beta1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.4.1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.4.0 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.4.0.rc2 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.4.0.rc1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.4.0.pre.rc.1 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.3.0 spec/unit/initializers/sprockets_spec.rb
locomotivecms_steam-1.3.0.rc2 spec/unit/initializers/sprockets_spec.rb