Sha256: 79064b3ea50f03e90e7eba17056ef26622791ab9acba2ff022a0310c9a6626ca

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 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(/^(\s*<script src="[^"]+"><\/script>\s*){3}$/) }
      end

      context "when debug mode disabled" do
        let(:assets_config) { Hash[:debug, false] }
        it { should match(/^(\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(/^(\s*<link rel="stylesheet" [^>]+>\s*){3}$/) }
      end

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-assets-0.7.7 spec/lib/jekyll/assets_plugin/renderer_spec.rb