spec/thingfish/processor/pdf_spec.rb
changeset 0 266fe36d11dd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spec/thingfish/processor/pdf_spec.rb	Wed Nov 16 13:11:39 2016 -0800
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+
+require_relative '../../spec_helper'
+
+require 'rspec'
+
+require 'thingfish'
+require 'thingfish/processor'
+
+require 'strelka'
+require 'strelka/httprequest/metadata'
+
+
+describe Thingfish::Processor, "PDF" do
+
+	before( :all ) do
+		Strelka::HTTPRequest.class_eval { include Strelka::HTTPRequest::Metadata }
+	end
+
+
+	let( :processor ) { described_class.create(:pdf) }
+
+	let( :factory ) do
+		Mongrel2::RequestFactory.new(
+			:route => '/',
+			:headers => {:accept => '*/*'})
+	end
+
+
+	it "extracts metadata from uploaded PDFs" do
+		req = factory.post( '/tf', fixture_data('hi.pdf'), 'Content-type' => 'application/pdf' )
+
+		processor.process_request( req )
+
+		expect( req.metadata ).to include( 'pdf:pagecount', 'pdf:producer' )
+	end
+end
+
+# vim: set nosta noet ts=4 sw=4 ft=rspec: