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 = %{test} body = @pdf.send :translate_paths, @body, @env body.should == "test" end it "should correctly parse relative url with double quotes" do @body = %{} body = @pdf.send :translate_paths, @body, @env body.should == "" end end end