Sha256: 8fb35ae5f251d597d053e5dffd1683a197add91a568dcc0811f9366bc96a6bb9

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8

RSpec.describe AssetList do
  context '#add' do
    it 'adds an asset to the list' do
      asset = instance_double 'Middleman::Sprockets::Asset'
      list  = AssetList.new

      expect {
        list << asset
      }.not_to raise_error
    end
  end
  context '#lookup' do
    it 'finds an asset in list' do
      asset = instance_double 'Middleman::Sprockets::Asset'
      expect(asset).to receive(:source_path).and_return 'path/to/source'
      expect(asset).to receive(:match?).and_return true

      list  = AssetList.new
      list << asset

      expect(list.lookup(asset)).to be asset
    end

    it 'supports a block which gets the found asset passed' do
      asset = instance_double 'Middleman::Sprockets::Asset'
      allow(asset).to receive(:source_path).and_return 'path/to/source'
      expect(asset).to receive(:destination_path=).with 'path/to/source'
      expect(asset).to receive(:match?).and_return true

      list  = AssetList.new
      list << asset

      list.lookup(asset) { |candidate, found_asset| found_asset.destination_path = found_asset.source_path }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
middleman-sprockets-3.3.10 spec/asset_list_spec.rb
middleman-sprockets-3.3.9 spec/asset_list_spec.rb
middleman-sprockets-3.3.8 spec/asset_list_spec.rb
middleman-sprockets-3.3.7 spec/asset_list_spec.rb
middleman-sprockets-cj-3.3.6 spec/asset_list_spec.rb
middleman-sprockets-3.3.6 spec/asset_list_spec.rb