Sha256: b465f0e0e0e28dff7214d18fdb8f3cf1fd32a383010926700f49398533befa70

Contents?: true

Size: 1.19 KB

Versions: 26

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8

require 'spec_helper'

require 'locomotive/wagon/commands/push_sub_commands/push_base_command'
require 'locomotive/wagon/commands/push_sub_commands/push_theme_assets_command'

describe Locomotive::Wagon::PushThemeAssetsCommand do

  let(:command)   { described_class.new(nil, nil, nil, nil) }

  describe '#replace_assets' do

    let(:content) { "body{background-image:url(/images/body.png)}" }
    let(:urls)    { { 'images/body.png' => 'http://cdn/images/body.png?42' } }

    before { command.instance_variable_set(:@remote_urls, urls) }

    subject { command.send(:replace_assets!, content) }

    it { is_expected.to eq "body{background-image:url(http://cdn/images/body.png?42)}" }

    context 'font' do

      let(:content) { "@font-face{src: url(\"/fonts/external/myfont.woff?first\");}" }
      let(:urls)  { { 'fonts/external/myfont.woff' => 'http://cdn/fonts/external/myfont.woff?42' } }

      it { is_expected.to eq "@font-face{src: url(\"http://cdn/fonts/external/myfont.woff?42\");}" }

    end

    context 'no correct reference to an image' do

      let(:content) { "body{background-image:url(/somewhere/body.png)}" }

      it { is_expected.to eq nil }

    end

  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
locomotivecms_wagon-3.0.0 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-3.0.0.rc0 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-3.0.0.beta2 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.4.1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.4.0 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.4.0.rc2 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.4.0.rc1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.3.0 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.3.0.rc1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.2.0 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.2.0.rc3 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.2.0.rc2 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.2.0.rc1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.2.0.beta1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.1.1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.1.0 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.1.0.rc5 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.1.0.rc4 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.1.0.rc3 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb
locomotivecms_wagon-2.0.1 spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb