Sha256: 5b0f5fa9ef404d68d07503cda93c19f85f18480d7480fd8f6d2d6a64a37c3ac2

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 KB

Contents

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

describe 'the inline_css filter' do
  it "is called \"inline_css\" as far as Config is concerned" do
    Rack::PageSpeed::Filters::InlineCSS.name.should == 'inline_css'
  end
  
  it "is a priority 10 filter" do
    Rack::PageSpeed::Filters::InlineCSS.priority.should == 10
  end
  
  context "#execute!" do
    before :each do
      @filter = Rack::PageSpeed::Filters::InlineCSS.new :public => Fixtures.path
      @document = Fixtures.styles
      @filter.execute! @document
    end

    it "returns false if there are no external CSS nodes in the document" do
      Rack::PageSpeed::Filters::InlineCSS.new(:public => Fixtures.path).execute!(Fixtures.noexternalcss).should be_false
    end

    it 'inlines CSS files that are smaller than 2kb in size by default' do
      @document.at_css('style').content.should == fixture('screen.css')
    end

    it 'does stuff, and the maximum size threshold is controlled via :max_size' do
      filter = Rack::PageSpeed::Filters::InlineCSS.new :max_size => 999999, :public => Fixtures.path
      filter.execute! @document
      @document.css('style').count.should == 2
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
rack-pagespeed-fork-0.1.1 spec/filters/inline_css_spec.rb
rack-pagespeed-fork-0.1.0 spec/filters/inline_css_spec.rb
rack-pagespeed-1.1.2 spec/filters/inline_css_spec.rb
rack-pagespeed-1.1.1 spec/filters/inline_css_spec.rb
rack-pagespeed-1.1.0 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.9 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.8 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.7 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.6 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.5 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.4 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.3 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.2 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.1 spec/filters/inline_css_spec.rb
rack-pagespeed-1.0.0 spec/filters/inline_css_spec.rb
rack-pagespeed-0.2.0 spec/filters/inline_css_spec.rb
rack-pagespeed-0.1.0 spec/filters/inline_css_spec.rb