require "spec_helper" require "pricecut" describe Pricecut::Elements::Element do let(:visitor) { Pricecut::MarkdownVisitor.new } let(:node) { parse "I am strongly emphasized." } 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