spec/lib/brief/document_spec.rb in brief-0.0.5 vs spec/lib/brief/document_spec.rb in brief-1.0.0

- old
+ new

@@ -1,35 +1,27 @@ require "spec_helper" -describe Brief::Document do - let(:path) { Brief.fixtures.join("sample.md") } - - let(:tutorial) do - Brief::Document.new(path: path) +describe "The Brief Document" do + let(:sample) do + path = Brief.example_path.join("docs","epic.html.md") + Brief::Document.new(path) end - it "should let me pass raw markdown" do - level_one = Brief::Document.new(path.read).tree.level(1) - expect(level_one.first.title).to eq("Heading One") + it "renders html" do + expect(sample.to_html).to include("<h1>User Stories</h1>") end - it "should let me pass a markdown file" do - level_one = Brief::Document.new(path).tree.level(1) - expect(level_one.first.title).to eq("Heading One") + it "parses the html" do + expect(sample.css("h1").length).to eq(2) end - describe "Parsers and Publishers" do - it "should have a parser" do - expect(tutorial.parser).not_to be_nil - end - - it "should have a publisher" do - expect(tutorial.publisher).not_to be_nil - end + it "deserializes YAML frontmatter into attributes" do + expect(sample.frontmatter.type).to eq("epic") end - describe "Finding code blocks by language" do - it "should find the blocks of code and group them by their language" do - expect(tutorial.code_blocks_by_language).not_to be_empty + context "Content Extraction" do + it "extracts content from a css selector" do + extracted = sample.extract_content(:args => ["h1:first-child"]) + expect(extracted).to eq("Blueprint Epic Example") end end end