Sha256: a1642071e404bdc0d5cad411b5bffcd0182893caffe9642d76762a1ad32ee417

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

require "spec_helper"
require "pricecut"

describe Pricecut::Elements::Element do
  let(:visitor) { Pricecut::MarkdownVisitor.new }
  let(:node) { parse "<strong><em>I am strongly emphasized.</em></strong>" }

  subject { described_class.new(visitor, node) }

  describe "#initialize" do
    it "initializes the visitor" do
      subject.visitor.should be(visitor)
    end

    it "initializes the node" do
      subject.node.should be(node)
    end
  end

  describe "#append_newline" do
    it "appends a newline to the output" do
      subject.append_newline

      visitor.output.should eq("\n")
    end
  end

  describe "#append_output" do
    it "appends output to the output" do
      subject.append_output("Output")

      visitor.output.should eq("Output")
    end
  end

  describe "#yield_children" do
    it "writes the output of the child nodes to the output" do
      subject.yield_children

      visitor.output.should eq("_I am strongly emphasized._")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pricecut-0.0.3 spec/pricecut/elements/element_spec.rb
pricecut-0.0.2 spec/pricecut/elements/element_spec.rb