Sha256: dcc46b3dc1fff6a88f5c13b1b44fa2fffa1224b86976ff332b2da27eb28bf685

Contents?: true

Size: 1.88 KB

Versions: 13

Compression:

Stored size: 1.88 KB

Contents

# encoding: utf-8
require 'spec_helper'

RSpec.describe AssetList do
  let(:creator_stub) { Class.new }
  let(:creator) { stub_const('Middleman::Presentation::Asset', creator_stub) }
  let(:asset) { instance_double('Middleman::Presentation::Asset') }

  context '#initialize' do
    it 'creates asset instances' do
      touch_file 'stylesheets/blub.scss'

      expect(creator).to receive(:new).with(source_path: absolute_path('stylesheets/blub.scss'), relative_source_path: 'stylesheets/blub.scss', destination_path: nil).and_return(asset)

      component1 = instance_double('Middleman::Presentation::Component')
      allow(component1).to receive(:path).and_return(absolute_path('.'))
      allow(component1).to receive(:base_path).and_return(absolute_path('.'))
      allow(component1).to receive(:output_paths).and_return([])
      allow(component1).to receive(:loadable_files).and_return([])
      allow(component1).to receive(:ignorable_files).and_return([])
      allow(component1).to receive(:importable_files).and_return([])

      components = []
      components << component1

      result = []
      AssetList.new(components).each { |a| result << a }

      expect(result).to include asset
    end
  end

  # context '#each' do
  #  it 'iterates of assets' do
  #    expect(creator).to receive(:new).with(source_path: absolute_path('images/image1.png'), relative_source_path: 'images/image1.png', destination_path: nil).and_return(asset)

  #    component1 = instance_double('Middleman::Presentation::Component')
  #    allow(component1).to receive(:path).and_return(absolute_path('images/image1.png'))
  #    allow(component1).to receive(:output_paths).and_return(absolute_path('images/image1.png'))

  #    components = []
  #    components << component1

  #    result = []
  #    result = AssetList.new(components).each { |a| result << a }

  #    expect(result).to include asset
  #  end
  # end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
middleman-presentation-core-0.17.7 spec/asset_list_spec.rb
middleman-presentation-core-0.17.6 spec/asset_list_spec.rb
middleman-presentation-core-0.17.5 spec/asset_list_spec.rb
middleman-presentation-core-0.17.2 spec/asset_list_spec.rb
middleman-presentation-core-0.17.1 spec/asset_list_spec.rb
middleman-presentation-core-0.17.0 spec/asset_list_spec.rb
middleman-presentation-core-0.16.3 spec/asset_list_spec.rb
middleman-presentation-core-0.16.2 spec/asset_list_spec.rb
middleman-presentation-core-0.16.0 spec/asset_list_spec.rb
middleman-presentation-core-0.16.0.rc2 spec/asset_list_spec.rb
middleman-presentation-core-0.16.0.rc1 spec/asset_list_spec.rb
middleman-presentation-core-0.16.0.beta spec/asset_list_spec.rb
middleman-presentation-core-0.16.0.alpha spec/asset_list_spec.rb