Sha256: 5d7e45a7ea4eefad112b88ea4688c6329b789e1012d613c8e60422392cc6d609
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' describe PDFKit::Middleware do describe "#translate_paths" do before do @pdf = PDFKit::Middleware.new({}) @env = {'REQUEST_URI' => 'http://example.com/document.pdf', 'rack.url_scheme' => 'http', 'HTTP_HOST' => 'example.com'} end it "should correctly parse relative url with single quotes" do @body = %{<html><head><link href='/stylesheets/application.css' media='screen' rel='stylesheet' type='text/css' /></head><body><img alt='test' src='/test.png' /></body></html>} body = @pdf.send :translate_paths, @body, @env body.should == "<html><head><link href=\"http://example.com/stylesheets/application.css\" media='screen' rel='stylesheet' type='text/css' /></head><body><img alt='test' src=\"http://example.com/test.png\" /></body></html>" end it "should correctly parse relative url with double quotes" do @body = %{<link href="/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />} body = @pdf.send :translate_paths, @body, @env body.should == "<link href=\"http://example.com/stylesheets/application.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pdfkit-0.3.3 | spec/middleware_spec.rb |
pdfkit-0.3.2 | spec/middleware_spec.rb |