Sha256: 3cd5e7cc00b6949df80acef725d8e84d9e9a103524bae16e29900ffb1fb973f4

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

require 'spec_helper'

describe 'Find escaped tags and entities' do

  before :each do
    @escaped_tag_notice = Rack::Escapee.new(TestApp.new, {:logfile => LOG_FILE})
    end

  it 'finds escaped strong tag' do
    @escaped_tag_notice.call Rack::MockRequest.env_for('/escaped_tag')
    last_line = ''
    File.open(LOG_FILE, 'r') do |f|
      while line = f.gets
        last_line = line
      end
    end

    last_line[32..-2].should == "WARN -- : rendering escaped tag: <strong> - /escaped_tag"
  end

  it 'finds escaped ampersand entity' do
    @escaped_tag_notice.call Rack::MockRequest.env_for('/escaped_entity')
    last_line = ''
    File.open(LOG_FILE, 'r') do |f|
      while line = f.gets
        last_line = line
      end
    end

    last_line[32..-2].should == "WARN -- : rendering escaped entity: & - /escaped_entity"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-escapee-0.1.0 spec/escaped_tags_and_entities_spec.rb