Sha256: 41a3282857ad4ee6c6ca118ddc03ac2bc4b1ee5f0a99be9f61b497444bf38336

Contents?: true

Size: 1.29 KB

Versions: 9

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'
require 'parslet/rig/rspec'
require 'pp'

describe Shortcode do

  let(:simple_quote)        { load_fixture :simple_quote }
  let(:simple_quote_output) { load_fixture :simple_quote_output, :html }

  context "simple_quote" do

    it "converts into html" do
      Shortcode.process(simple_quote).should == simple_quote_output
    end

  end

  context "erb templates" do

    before(:each) do
      Shortcode.setup do |config|
        config.template_parser = :erb
        config.template_path = File.join File.dirname(__FILE__), "support/templates/erb"
      end
    end

    it "converts into html" do
      Shortcode.process(simple_quote).gsub("\n",'').should == simple_quote_output.gsub("\n",'')
    end
  end

  context "configuration" do

    describe "block_tags" do

      before do
        Shortcode.setup do |config|
          config.block_tags = []
        end
      end

      it "handles an empty array" do
        expect { Shortcode.process(simple_quote) }.to_not raise_error
      end

    end

    describe "self_closing_tags" do

      before do
        Shortcode.setup do |config|
          config.self_closing_tags = []
        end
      end

      it "handles an empty array" do
        expect { Shortcode.process(simple_quote) }.to_not raise_error
      end

    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
shortcode-0.3.3 spec/shortcode_spec.rb
shortcode-0.3.2 spec/shortcode_spec.rb
shortcode-0.3.1 spec/shortcode_spec.rb
shortcode-0.3.0 spec/shortcode_spec.rb
shortcode-0.2.0 spec/shortcode_spec.rb
shortcode-0.1.2 spec/shortcode_spec.rb
shortcode-0.1.1 spec/shortcode_spec.rb
shortcode-0.1.0 spec/shortcode_spec.rb
shortcode-0.0.4 spec/shortcode_spec.rb