Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 31 lines (26 sloc) 0.842 kb
16272048 » jonmagic
2011-10-13 Refactored to decouple and make easier reading.
1 require 'spec_helper'
2
3 describe PdfUploader do
4 let(:document) { Document.create(:pdf => pdf_fixture('onepage.pdf')) }
5
6 describe "#cache_dir" do
7 it "returns correct path" do
8 document.pdf.cache_dir.should == "#{PdfArchive.root}/tmp/cache/#{document.id}"
9 end
10 end
11
12 describe "#store_dir" do
13 it "returns correct path" do
14 document.pdf.store_dir.should == "#{PdfArchive.root}/tmp/documents/#{document.id}"
15 end
16 end
17
18 describe "#grim" do
19 it "returns an instance of Grim::Pdf" do
20 document.pdf.grim.class.should == Grim::Pdf
21 end
22 end
23
24 describe "#create_preview" do
25 it "creates a preview image" do
c877042f » jonmagic
2011-10-21 Add a PreviewStore for the preview image.
26 document.preview = File.open(document.pdf.create_preview)
27 document.save!
16272048 » jonmagic
2011-10-13 Refactored to decouple and make easier reading.
28 File.exists?(File.join(tmp_dir, 'documents', document.id, 'preview.jpg')).should be_true
29 end
30 end
31 end
Something went wrong with that request. Please try again.