Sha256: aae75cd4fe58687450df52bf6c3cc1485138d673f5ca32e228b018c883435057

Contents?: true

Size: 1.21 KB

Versions: 52

Compression:

Stored size: 1.21 KB

Contents

require "spec_helper"

describe "Document Templates" do
  let(:data) do
    {
      title: "Epic Example",
      status: "published",
      type: "epic",
      features:[{
        title: "A user wants to do something",
        paragraph: "As a user I would like to do something so that I can succeed",
        goal: "I can succeed",
        persona: "user",
        behavior: "do something"
      },{
        title: "A user wants to do something else",
        paragraph: "As a user I would like to do something else so that I can succeed"
      }]
    }
  end

  it "has template body" do
    expect(Brief::Epic.template_body).not_to be_empty
  end

  it "has an example" do
    expect(Brief::Epic.example_body).not_to be_empty
  end

  it "takes a hash of data and renders yaml frontmatter" do
    expect(Brief::Document.create_from_data(data).title).to eq("Epic Example")
  end

  it "supports more complex renderings" do
    doc = Brief::Document.create_from_data(data)
    content = doc.content

    expect(content).to include("# Features")
    expect(content).to include("# Epic Example")
    expect(content).to include("## A user wants to do something")
    expect(content).to include("## A user wants to do something else")
  end

end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
brief-1.11.9 spec/lib/brief/template_spec.rb
brief-1.11.8 spec/lib/brief/template_spec.rb
brief-1.11.7 spec/lib/brief/template_spec.rb
brief-1.11.6 spec/lib/brief/template_spec.rb
brief-1.11.5 spec/lib/brief/template_spec.rb
brief-1.11.4 spec/lib/brief/template_spec.rb
brief-1.11.3 spec/lib/brief/template_spec.rb
brief-1.11.2 spec/lib/brief/template_spec.rb
brief-1.11.1 spec/lib/brief/template_spec.rb
brief-1.11.0 spec/lib/brief/template_spec.rb
brief-1.10.1 spec/lib/brief/template_spec.rb
brief-1.10.0 spec/lib/brief/template_spec.rb