diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-13 19:03:34 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-13 19:03:34 +0000 |
commit | dd21fa907cae6dffbb6d351949899c04c8d20523 (patch) | |
tree | dd92bb16b920f638b9c2063bc9c55e757c717f1b | |
parent | 2e7ec67bfb99ee19e4fbadf9bebd9d0e0f4299d9 (diff) |
Only offer download links on publicly visible requests
-rw-r--r-- | app/views/request/_after_actions.rhtml | 2 | ||||
-rw-r--r-- | spec/views/request/_after_actions.rhtml_spec.rb | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml index 580ff0e87..221634549 100644 --- a/app/views/request/_after_actions.rhtml +++ b/app/views/request/_after_actions.rhtml @@ -15,9 +15,11 @@ <%= link_to _('Update the status of this request'), '#describe_state_form_1' %> </li> <% end %> + <% if @info_request.all_can_view? %> <li> <%= link_to _("Download a zip file of all correspondence"), download_entire_request_url(:url_title => @info_request.url_title) %> </li> + <% end %> </ul> </div> <% if ! @info_request.is_external? %> diff --git a/spec/views/request/_after_actions.rhtml_spec.rb b/spec/views/request/_after_actions.rhtml_spec.rb index 5b4734c52..548990c9f 100644 --- a/spec/views/request/_after_actions.rhtml_spec.rb +++ b/spec/views/request/_after_actions.rhtml_spec.rb @@ -13,7 +13,8 @@ describe 'when displaying actions that can be taken with regard to a request' do :is_external? => false, :public_body => @mock_body, :comments_allowed? => true, - :url_title => 'test_request') + :url_title => 'test_request', + :all_can_view? => true) assigns[:info_request] = @mock_request end @@ -83,4 +84,19 @@ describe 'when displaying actions that can be taken with regard to a request' do expect_owner_link('Request an internal review') end + describe 'if the request is viewable by all' do + + it 'should display the link to download the entire request' do + expect_anyone_link('Download a zip file of all correspondence') + end + end + + describe 'if the request is not viewable by all' do + + it 'should not display the link to download the entire request' do + @mock_request.stub!(:all_can_view?).and_return(false) + expect_no_anyone_link('Download a zip file of all correspondence') + end + end + end |