Sha256: 32e914c4db55ff31806bc45054b67130aa20ce7f8bcdc702ca088d9955fe5a9a

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8
#
# This file is part of the mbrao gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
#

require "spec_helper"

describe HTML::Pipeline::KramdownFilter do
  describe "#initialize" do
    it "should call the parent constructor" do
      expect(HTML::Pipeline::TextFilter).to receive(:new).with("\rCONTENT\r", {a: "b"}, {c: "d"})
      HTML::Pipeline::KramdownFilter.new("\rCONTENT\r", {a: "b"}, {c: "d"})
    end

    it "should remove \r from the text" do
      subject = HTML::Pipeline::KramdownFilter.new("\rCONTENT\r", {a: "b"}, {c: "d"})
      expect(subject.instance_variable_get(:@text)).to eq("CONTENT")
    end

    it "should use Kramdown with given options for building the result" do
      object = Object.new
      expect(Kramdown::Document).to receive(:new).with("CONTENT", {a: "b"}).and_return(object)
      expect(object).to receive(:to_html)
      HTML::Pipeline::KramdownFilter.new("\rCONTENT\r", {a: "b"}, {c: "d"}).call
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mbrao-1.6.0 spec/mbrao/rendering_engines/html_pipeline/kramdown_filter_spec.rb
mbrao-1.5.0 spec/mbrao/rendering_engines/html_pipeline/kramdown_filter_spec.rb