Sha256: 5178ff2fd052da55a27e95e895af29785996765cdb6c9c8835e1335b9f4b9be4

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

require "spec_helper"

describe "template parsers", type: :feature do
  let(:simple_quote)        { load_fixture :simple_quote }
  let(:simple_quote_output) { load_fixture :simple_quote_output, :html }

  let(:shortcode) { Shortcode.new }
  let(:configuration) { shortcode.configuration }

  context "erb" do
    before do
      configuration.block_tags = [:quote]
      configuration.template_parser = :erb
      configuration.template_path = File.join File.dirname(__FILE__), "support/templates/erb"
    end

    it "can render a template" do
      expect(shortcode.process(simple_quote).delete("\n")).to eq(simple_quote_output)
    end
  end

  context "haml" do
    before do
      configuration.block_tags = [:quote]
      configuration.template_parser = :haml
      configuration.template_path = File.join File.dirname(__FILE__), "support/templates/haml"
    end

    it "can render a template" do
      expect(shortcode.process(simple_quote).delete("\n").gsub(">  <", "><")).to eq(simple_quote_output)
    end
  end

  context "slim" do
    before do
      configuration.block_tags = [:quote]
      configuration.template_parser = :slim
      configuration.template_path = File.join File.dirname(__FILE__), "support/templates/slim"
    end

    it "can render a template" do
      expect(shortcode.process(simple_quote).delete("\n")).to eq(simple_quote_output)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shortcode-2.0.0 spec/template_parsers_spec.rb
shortcode-2.0.0.pre spec/template_parsers_spec.rb