equal
deleted
inserted
replaced
|
1 #!/usr/bin/env ruby |
|
2 |
|
3 require_relative '../../spec_helper' |
|
4 |
|
5 require 'rspec' |
|
6 |
|
7 require 'thingfish' |
|
8 require 'thingfish/processor' |
|
9 |
|
10 require 'strelka' |
|
11 require 'strelka/httprequest/metadata' |
|
12 |
|
13 |
|
14 describe Thingfish::Processor, "PDF" do |
|
15 |
|
16 before( :all ) do |
|
17 Strelka::HTTPRequest.class_eval { include Strelka::HTTPRequest::Metadata } |
|
18 end |
|
19 |
|
20 |
|
21 let( :processor ) { described_class.create(:pdf) } |
|
22 |
|
23 let( :factory ) do |
|
24 Mongrel2::RequestFactory.new( |
|
25 :route => '/', |
|
26 :headers => {:accept => '*/*'}) |
|
27 end |
|
28 |
|
29 |
|
30 it "extracts metadata from uploaded PDFs" do |
|
31 req = factory.post( '/tf', fixture_data('hi.pdf'), 'Content-type' => 'application/pdf' ) |
|
32 |
|
33 processor.process_request( req ) |
|
34 |
|
35 expect( req.metadata ).to include( 'pdf:pagecount', 'pdf:producer' ) |
|
36 end |
|
37 end |
|
38 |
|
39 # vim: set nosta noet ts=4 sw=4 ft=rspec: |