Sha256: da712f837e4b976ed7a235acb64cb2e9474ef918933572976e57d8a3cdf798d0

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

require 'spec_helper'

describe Hexp::Unparser do
  let(:unparser) { described_class.new({}) }
  let(:node) { H[:p, %q{Hello "world", it's great meet & chat >.<}] }
  let(:html) { unparser.call(node) }

  it 'should escape sensitive characters' do
    expect(html).to eql '<p>Hello &quot;world&quot;, it&#x27;s great meet &amp; chat &gt;.&lt;</p>'
  end

  context 'inside a script tag' do
    let(:node) { H[:script, %q{Hello "world", }, %q{it's great meet & chat >.<}] }

    it 'should not escape' do
      expect(html).to eql %q{<script>Hello "world", it's great meet & chat >.<</script>}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hexp-0.4.6 spec/unit/hexp/unparser_spec.rb
hexp-0.4.5 spec/unit/hexp/unparser_spec.rb