diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-08-21 14:01:22 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-16 12:42:19 +0100 |
commit | d65804b7d8d2138b4570b26449321e1a9bb847fb (patch) | |
tree | 80984cf9acfebecfac859d82e410f98bfaa7975d /spec/integration | |
parent | ebee053ec8514f70f94309f306bf1e82050c4c33 (diff) |
Remove hidden incoming messages from correspondence.txt
Adds a spec for what we want to see - no message text in
correspondence.txt, and no attachments. Refactors the
simple_correspondence templates to make it clearer that these are doing
the same job as the html.erb ones, for text.
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/download_request_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/integration/download_request_spec.rb b/spec/integration/download_request_spec.rb index 563efbf50..33e90d435 100644 --- a/spec/integration/download_request_spec.rb +++ b/spec/integration/download_request_spec.rb @@ -50,6 +50,40 @@ describe 'when making a zipfile available' do end 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 + + # 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 + + 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' do info_request = info_requests(:external_request) |