aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-08-22 10:34:39 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-16 12:42:19 +0100
commit2fdf336adb60e9010952a5fb7f593febc3fdffa2 (patch)
tree0204e06167c29e7c9f93034572dc12fa0b18ef77
parent64139935c8de9c08d3c68e9ef9810af5af8a2131 (diff)
Make absence of htmltopdf converter more explicit.
We're testing the code path where there is no converter here.
-rw-r--r--spec/integration/download_request_spec.rb99
1 files changed, 52 insertions, 47 deletions
diff --git a/spec/integration/download_request_spec.rb b/spec/integration/download_request_spec.rb
index 62e38c607..8af1c9ff1 100644
--- a/spec/integration/download_request_spec.rb
+++ b/spec/integration/download_request_spec.rb
@@ -24,66 +24,71 @@ describe 'when making a zipfile available' do
receive_incoming_mail(name, info_request.incoming_email)
end
- it "should update the contents of the zipfile when the request changes" do
-
- info_request = FactoryGirl.create(:info_request_with_incoming)
- request_owner = login(info_request.user)
- inspect_zip_download(request_owner, info_request) do |zip|
- zip.count.should == 1 # just the message
- expected = 'This is a plain-text version of the Freedom of Information request "Example Title"'
- zip.read('correspondence.txt').should match expected
- end
-
- sleep_and_receive_mail('incoming-request-two-same-name.email', info_request)
+ context 'when no html to pdf converter is supplied' do
- inspect_zip_download(request_owner, info_request) do |zip|
- zip.count.should == 3 # the message plus two "hello-world.txt" files
- zip.read('2_hello world.txt').should match('Second hello')
- zip.read('3_hello world.txt').should match('First hello')
+ before do
+ AlaveteliConfiguration.stub!(:html_to_pdf_command).and_return('')
end
- sleep_and_receive_mail('incoming-request-attachment-unknown-extension.email', info_request)
+ it "should update the contents of the zipfile when the request changes" do
- inspect_zip_download(request_owner, info_request) do |zip|
- zip.count.should == 4 # the message plus two "hello-world.txt" files, and the new attachment
- zip.read('2_hello.qwglhm').should match('This is an unusual')
- end
- end
+ info_request = FactoryGirl.create(:info_request_with_incoming)
+ request_owner = login(info_request.user)
+ inspect_zip_download(request_owner, info_request) do |zip|
+ zip.count.should == 1 # just the message
+ expected = 'This is a plain-text version of the Freedom of Information request "Example Title"'
+ zip.read('correspondence.txt').should match expected
+ end
- context 'when an incoming message is made "requester_only"' do
- it 'should not include the incoming message or attachments in a download of the entire request
- by a non-request owner', :focus => true do
+ sleep_and_receive_mail('incoming-request-two-same-name.email', info_request)
- # Non-owner can download zip with incoming and attachments
- non_owner = login(FactoryGirl.create(:user))
- info_request = FactoryGirl.create(:info_request_with_incoming_attachments)
- inspect_zip_download(non_owner, info_request) do |zip|
- zip.count.should == 3
- zip.read('correspondence.txt').should match('hereisthetext')
+ inspect_zip_download(request_owner, info_request) do |zip|
+ zip.count.should == 3 # the message plus two "hello-world.txt" files
+ zip.read('2_hello world.txt').should match('Second hello')
+ zip.read('3_hello world.txt').should match('First hello')
end
- # Admin makes the incoming message requester only
- admin = login(FactoryGirl.create(:admin_user))
- post_data = {:incoming_message => {:prominence => 'requester_only',
- :prominence_reason => 'boring'}}
- admin.post_via_redirect "/en/admin/incoming/update/#{info_request.incoming_messages.first.id}", post_data
- admin.response.should be_success
-
- inspect_zip_download(non_owner, info_request) do |zip|
- zip.count.should == 1
- correspondence_text = zip.read('correspondence.txt')
- correspondence_text.should_not match('hereisthetext')
- expected_text = 'This message has been hidden. boring'
- correspondence_text.should match(expected_text)
- end
+ sleep_and_receive_mail('incoming-request-attachment-unknown-extension.email', info_request)
+ inspect_zip_download(request_owner, info_request) do |zip|
+ zip.count.should == 4 # the message plus two "hello-world.txt" files, and the new attachment
+ zip.read('2_hello.qwglhm').should match('This is an unusual')
+ end
end
- it 'should include the incoming message and attachments in a download of the entire request
- by the owner'
+ context 'when an incoming message is made "requester_only"' do
+ it 'should not include the incoming message or attachments in a download of the entire request
+ by a non-request owner' do
+
+ # Non-owner can download zip with incoming and attachments
+ non_owner = login(FactoryGirl.create(:user))
+ info_request = FactoryGirl.create(:info_request_with_incoming_attachments)
+ inspect_zip_download(non_owner, info_request) do |zip|
+ zip.count.should == 3
+ zip.read('correspondence.txt').should match('hereisthetext')
+ end
+
+ # Admin makes the incoming message requester only
+ admin = login(FactoryGirl.create(:admin_user))
+ post_data = {:incoming_message => {:prominence => 'requester_only',
+ :prominence_reason => 'boring'}}
+ admin.post_via_redirect "/en/admin/incoming/update/#{info_request.incoming_messages.first.id}", post_data
+ admin.response.should be_success
+
+ inspect_zip_download(non_owner, info_request) do |zip|
+ zip.count.should == 1
+ correspondence_text = zip.read('correspondence.txt')
+ correspondence_text.should_not match('hereisthetext')
+ expected_text = 'This message has been hidden. boring'
+ correspondence_text.should match(expected_text)
+ end
- end
+ end
+ it 'should include the incoming message and attachments in a download of the entire request
+ by the owner'
+
+ end
it 'should successfully make a zipfile for an external request', :focus => true do
external_request = FactoryGirl.create(:external_request)