Sha256: ad91e7f67545cc59223c43bb566f309fe2491ff0051d0cc1687c6326eb77e6e6

Contents?: true

Size: 869 Bytes

Versions: 49

Compression:

Stored size: 869 Bytes

Contents

require 'spec_helper'

require_relative '../../../lib/locomotive/steam/middlewares/dynamic_assets'

describe Locomotive::Steam::Middlewares::DynamicAssets do

  let(:app)         { ->(env) { [200, env, 'app'] }}
  let(:options)     { { root: File.dirname(__FILE__), minify: true } }
  let(:middleware)  { described_class.new(app, options) }

  describe '#call' do

    let(:env) { { 'PATH_INFO' => '/stylesheets/application.css' } }
    subject { middleware.call(env) }

    it 'calls sprockets to process the asset' do
      expect(middleware.assets).to receive(:call).with(env).and_return(true)
      is_expected.to eq true
    end

    context 'not an asset' do

      let(:env) { { 'PATH_INFO' => '/index' } }

      it 'bypasses sprockets' do
        expect(middleware.assets).not_to receive(:call)
        is_expected.not_to eq nil
      end

    end

  end

end

Version data entries

49 entries across 49 versions & 1 rubygems

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