Sha256: 52f8fb389bd1f027115ed814adee4df9adf03cc7e29bb6d41fce12336f25d13e

Contents?: true

Size: 1000 Bytes

Versions: 4

Compression:

Stored size: 1000 Bytes

Contents

require "rails_helper"

describe Blogit::ApplicationHelper do

  describe "format_content" do
    it "should convert markdown text to html if conf is :markdown" do
      Blogit.configure { |c| c.default_parser = :markdown }
      expect(helper.format_content("## Hello\n\nWorld")).to match(/<h2>Hello<\/h2>\n\n<p>World<\/p>/)
    end

    it "should convert textile text to html if conf is :textile" do
      Blogit.configure { |c| c.default_parser = :textile }
      expect(helper.format_content("h1. Hello\n\nWorld")).to eq("<h1>Hello</h1>\n<p>World</p>")
    end

    it "should leave html text as html if conf is :html" do
      Blogit.configure { |c| c.default_parser = :html }
      string = "<h1>Hello</h1>\n\n<p>World</p>"
      expect(helper.format_content(string)).to eq(string)
    end
  end

  describe "actions" do
    it "should create a div with class 'actions'" do
      expect(helper.actions do
        "hello"
      end).to eq(%{<div class="actions">hello</div>})
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blogit-1.1.2 spec/helpers/blogit/application_helper_spec.rb
blogit-1.1.1 spec/helpers/blogit/application_helper_spec.rb
blogit-1.1.0 spec/helpers/blogit/application_helper_spec.rb
blogit-1.0.0 spec/helpers/blogit/application_helper_spec.rb