Sha256: d143d1488a86377cc7c5f95a17f3eb6b05591db7eca8155377a89ec7472e8e54

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe TP::Slide do
  subject(:slide) { klass.new markdown }

  let(:markdown) {
    "# First Slide\n\n* Bullet 1\n* Bullet 2"
  }

  its(:markdown) { should == markdown }

  context "with bullets" do
    let(:markdown) {
      "# First Slide\n\n* Bullet 1\n* Bullet 2"
    }

    its(:header) { should == "First Slide" }
    its(:body) { should == "* Bullet 1\n* Bullet 2" }

    its(:bullets) { should =~ ["Bullet 1", "Bullet 2"] }
    its(:paragraph) { should be_nil }
  end

  context "with a paragraph" do
    let(:markdown) {
      "# First Slide\n\nThis is a paragraph of text"
    }

    its(:header) { should == "First Slide" }
    its(:body) { should == "This is a paragraph of text" }

    its(:bullets) { should be_nil }
    its(:paragraph) { should == "This is a paragraph of text" }
  end

  context "with just a header" do
    let(:markdown) {
      "# First Slide"
    }

    its(:header) { should == "First Slide" }
    its(:body) { should be_nil }

    its(:bullets) { should be_nil }
    its(:paragraph) { should be_nil }
  end

  context "with trailing newlines" do
    let(:markdown) {
      "# First Slide\n\n* Bullet 1\n* Bullet 2\n\n"
    }

    it "strips whitespace" do
      slide.markdown.should == "# First Slide\n\n* Bullet 1\n* Bullet 2"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tp-0.1.1 spec/lib/tp/slide_spec.rb
tp-0.1.0 spec/lib/tp/slide_spec.rb
tp-0.0.2 spec/lib/tp/slide_spec.rb