Sha256: 0bd25ad84b6ebf76dff262bd09eebe32098e7d79df5b8af8bc39292b0209a77c

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

# stdlib
require "ostruct"


require "spec_helper"


module Jekyll::AssetsPlugin
  describe Renderer do

    let(:site) do
      Jekyll::Site.new Jekyll.configuration({
        "source"      => fixtures_path.to_s,
        "destination" => @dest.to_s,
        "assets"      => assets_config
      })
    end


    let(:renderer) do
      context = OpenStruct.new(:registers => { :site => site })
      Renderer.new context, "app"
    end


    describe "#render_javascript" do
      subject { renderer.render_javascript }

      context "when debug mode enabled" do
        let(:assets_config){ Hash[:debug, true] }
        it { should match %r{^(\s*<script src="[^"]+"></script>\s*){3}$} }
      end

      context "when debug mode disabled" do
        let(:assets_config){ Hash[:debug, false] }
        it { should match %r{^(\s*<script src="[^"]+"></script>\s*){1}$} }
      end
    end


    describe "#render_stylesheet" do
      subject { renderer.render_stylesheet }

      context "when debug mode enabled" do
        let(:assets_config){ Hash[:debug, true] }
        it { should match %r{^(\s*<link rel="stylesheet" href="[^"]+">\s*){3}$} }
      end

      context "when debug mode disabled" do
        let(:assets_config){ Hash[:debug, false] }
        it { should match %r{^(\s*<link rel="stylesheet" href="[^"]+">\s*){1}$} }
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jekyll-assets-0.7.6 spec/lib/jekyll/assets_plugin/renderer_spec.rb
jekyll-assets-0.7.5 spec/lib/jekyll/assets_plugin/renderer_spec.rb
jekyll-assets-0.7.4 spec/lib/jekyll/assets_plugin/renderer_spec.rb
jekyll-assets-0.7.3 spec/lib/jekyll/assets_plugin/renderer_spec.rb
jekyll-assets-0.7.2 spec/lib/jekyll/assets_plugin/renderer_spec.rb
jekyll-assets-0.7.1 spec/lib/jekyll/assets_plugin/renderer_spec.rb
jekyll-assets-0.7.0 spec/lib/jekyll/assets_plugin/renderer_spec.rb