aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/incoming_message_spec.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 70d92356f..5fcc534ca 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -160,10 +160,12 @@ describe IncomingMessage, " when censoring data" do
data.should == "His email was x\000x\000x\000@\000x\000x\000x\000.\000x\000x\000x\000, indeed"
end
- # As at March 9th 2010: This test fails with pdftk 1.41+dfsg-1 installed
- # which is in Ubuntu Karmic. It works again for the lasest version
- # 1.41+dfsg-7 in Debian unstable. And it works for Debian stable.
- it "should replace everything in PDF files" do
+
+
+ def pdf_replacement_test(use_ghostscript_compression)
+ config = MySociety::Config.load_default()
+ previous = config['USE_GHOSTSCRIPT_COMPRESSION']
+ config['USE_GHOSTSCRIPT_COMPRESSION'] = use_ghostscript_compression
orig_pdf = load_file_fixture('tfl.pdf')
pdf = orig_pdf.dup
@@ -175,6 +177,15 @@ describe IncomingMessage, " when censoring data" do
masked_text = IncomingMessage._get_attachment_text_internal_one_file('application/pdf', pdf)
masked_text.should_not match(/foi@tfl.gov.uk/)
masked_text.should match(/xxx@xxx.xxx.xx/)
+ config['USE_GHOSTSCRIPT_COMPRESSION'] = previous
+ end
+
+ it "should replace everything in PDF files using pdftk" do
+ pdf_replacement_test(false)
+ end
+
+ it "should replace everything in PDF files using ghostscript" do
+ pdf_replacement_test(true)
end
it "should not produce zero length output if pdftk silently fails" do