Sha256: 6ee2b48427376e16ecbc439b9891a1b0aff836d4f9521909156214c610a0f03f

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AutoHtml::SimpleFormat do
  it 'formats input using simple rules' do
    result = subject.call('Hey check out my blog => http://rors.org')
    expect(result).to eq '<p>Hey check out my blog => http://rors.org</p>'

    expect(subject.call("crazy\r\n cross\r platform linebreaks")).to eq "<p>crazy\n<br /> cross\n<br /> platform linebreaks</p>"
    expect(subject.call("A paragraph\n\nand another one!")).to eq "<p>A paragraph</p>\n\n<p>and another one!</p>"
    expect(subject.call("A paragraph\n With a newline")).to eq "<p>A paragraph\n<br /> With a newline</p>"

    expect(subject.call("A\nB\nC\nD")).to eq "<p>A\n<br />B\n<br />C\n<br />D</p>"

    expect(subject.call("A\r\n  \nB\n\n\r\n\t\nC\nD")).to eq "<p>A\n<br />  \n<br />B</p>\n\n<p>\t\n<br />C\n<br />D</p>"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auto_html-2.1.1 spec/auto_html/simple_format_spec.rb
auto_html-2.1.0 spec/auto_html/simple_format_spec.rb
auto_html-2.0.2 spec/auto_html/simple_format_spec.rb