Sha256: a40ade47b4fcb6e5d8cc8c45b9cf8dbeb8c977415908274097524f749110d1ea

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe 'the combine_css filter' do
  it "is called \"combine_css\" as far as Config is concerned" do
    Rack::PageSpeed::Filters::CombineCSS.name.should == 'combine_css'
  end

  it "requires a store mechanism to be passed via :store when initializing" do
    Rack::PageSpeed::Filters::CombineCSS.new.should be_false
  end
  
  it "is a priority 9 filter" do
    Rack::PageSpeed::Filters::CombineCSS.priority.should == 9
  end

  context 'execute!' do
    before :each do
      @filter = Rack::PageSpeed::Filters::CombineCSS.new :public => Fixtures.path, :store => {}
    end

    it 'cuts down the number of scripts in the fixtures from 5 to 1' do
      expect { @filter.execute! Fixtures.complex }.to change { Fixtures.complex.css('link[rel="stylesheet"][href$=".css"]:not([href^="http"])').count }.from(5).to(1)
    end
    
    it "stores the nodes' contents in the store passed through the initializer" do
      @filter.instance_variable_get(:@options)[:store].should_receive(:[]=)
      @filter.execute! Fixtures.complex
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rack-pagespeed-1.0.3 spec/filters/combine_css_spec.rb
rack-pagespeed-1.0.2 spec/filters/combine_css_spec.rb
rack-pagespeed-1.0.1 spec/filters/combine_css_spec.rb
rack-pagespeed-1.0.0 spec/filters/combine_css_spec.rb
rack-pagespeed-0.2.0 spec/filters/combine_css_spec.rb
rack-pagespeed-0.1.0 spec/filters/combine_css_spec.rb