Sha256: b2b601caf31570320e30a47806d4071f459f3b2f4c562548f3ad77a4245ab99b

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe "Inky#release_the_kraken" do
  it "works on binary text" do
    input = '<container/>'.b
    expected = <<-HTML
      <table class="container" align="center">
        <tbody>
          <tr>
            <td></td>
          </tr>
        </tbody>
      </table>
    HTML

    output = Inky::Core.new.release_the_kraken(input)
    expect_same_html(output, expected)
  end

  it "works on utf-8 text" do
    input = '<container><p>Güten tag Marc-André</p></container>'
    expected = <<-HTML
      <table class="container" align="center">
        <tbody>
          <tr>
            <td><p>Güten tag Marc-André</p></td>
          </tr>
        </tbody>
      </table>
    HTML

    output = Inky::Core.new.release_the_kraken(input)
    expect_same_html(output, expected)
  end

  it "works on US-ASCII text" do
    input = '<container><p>G&#252;ten tag Marc-Andr&#233;</p></container>'.force_encoding("us-ascii")
    expected = <<-HTML
      <table class="container" align="center">
        <tbody>
          <tr>
            <td><p>G&#252;ten tag Marc-Andr&#233;</p></td>
          </tr>
        </tbody>
      </table>
    HTML

    output = Inky::Core.new.release_the_kraken(input)
    expect_same_html(output, expected)
    output.encoding.name.should == 'US-ASCII'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inky-rb-1.4.2.1 spec/inky_spec.rb
inky-rb-1.4.2.0 spec/inky_spec.rb
inky-rb-1.3.8.0 spec/inky_spec.rb
inky-rb-1.3.7.5 spec/inky_spec.rb
inky-rb-1.3.7.4 spec/inky_spec.rb
inky-rb-1.3.7.3 spec/inky_spec.rb