Sha256: 64c6ffc6aff6a52fdfe4a83cac26d7b4d445c5debeb4f7beb1ad5cfc096bcd59

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

# encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')

describe EscapeUtils do
  it "should respond to escape_html" do
    EscapeUtils.should respond_to(:escape_html)
  end

  context "escape_html" do
    it "should escape a basic html tag" do
      EscapeUtils.escape_html("<some_tag/>").should eql("&lt;some_tag/&gt;")
    end

    it "should escape double-quotes" do
      EscapeUtils.escape_html("<some_tag some_attr=\"some value\"/>").should eql("&lt;some_tag some_attr=&quot;some value&quot;/&gt;")
    end

    it "should escape single-quotes" do
      EscapeUtils.escape_html("<some_tag some_attr='some value'/>").should eql("&lt;some_tag some_attr=&#39;some value&#39;/&gt;")
    end

    it "should escape the & character" do
      EscapeUtils.escape_html("<b>Bourbon & Branch</b>").should eql("&lt;b&gt;Bourbon &amp; Branch&lt;/b&gt;")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
escape_utils-0.1.0 spec/html/escape_spec.rb