Sha256: 5253d52b0bbf1b9c3a83704ed0caf9cc7aa05972ef4653ea2939486cf223aaaf
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'spec_helper' require 'ore/template/helpers/markdown' describe Ore::Template::Helpers::Markdown do subject do Object.new.extend described_class end describe "#link_to" do let(:text) { "foo bar" } let(:url) { "https://example.com/foo/bar" } it "should return a link with the text and url" do expect(subject.link_to(text,url)).to be == "[#{text}](#{url})" end end describe "#image" do let(:url) { "https://example.com/foo/bar.png" } context "with alt text" do let(:alt) { "foo bar" } it "should return a link with the alt text and url" do expect(subject.image(url,alt)).to be == "![#{alt}](#{url})" end end context "without alt text" do it "should return a link with the alt text and url" do expect(subject.image(url)).to be == "![](#{url})" end end end describe "#h1" do let(:title) { "Foo Bar" } it "should return a h1 header" do expect(subject.h1(title)).to be == "# #{title}" end end describe "#h2" do let(:title) { "Foo Bar" } it "should return a h2 header" do expect(subject.h2(title)).to be == "## #{title}" end end describe "#h3" do let(:title) { "Foo Bar" } it "should return a h3 header" do expect(subject.h3(title)).to be == "### #{title}" end end describe "#h4" do let(:title) { "Foo Bar" } it "should return a h4 header" do expect(subject.h4(title)).to be == "#### #{title}" end end describe "#pre" do let(:lines) do [ %{puts "hello"}, %{}, %{puts "world"} ] end let(:code) { lines.join($/) } it "should indent each line" do expect(subject.pre(code)).to be == lines.map { |line| " #{line}" }.join($/) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ore-0.11.0 | spec/template/helpers/markdown_spec.rb |