aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/request_controller_spec.rb12
-rw-r--r--spec/views/request/_after_actions.rhtml_spec.rb18
2 files changed, 28 insertions, 2 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 4e8a11d45..521ad7b5a 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -727,6 +727,16 @@ describe RequestController, "when showing one request" do
describe 'when making a zipfile available' do
+ it 'should return a 410 for a request that is hidden' do
+ title = 'why_do_you_have_such_a_fancy_dog'
+ ir = info_requests(:fancy_dog_request)
+ ir.prominence = 'hidden'
+ ir.save!
+ get :download_entire_request, {:url_title => title}, { :user_id => ir.user.id }
+ response.should render_template('request/hidden')
+ response.code.should == '410'
+ end
+
it "should have a different zipfile URL when the request changes" do
title = 'why_do_you_have_such_a_fancy_dog'
ir = info_requests(:fancy_dog_request)
@@ -765,7 +775,7 @@ describe RequestController, "when showing one request" do
info_request = info_requests(:external_request)
get :download_entire_request, { :url_title => info_request.url_title },
{ :user_id => users(:bob_smith_user) }
- response.location.should have_text(/#{assigns[:url_path]}/)
+ response.location.should have_text(/#{assigns[:url_path]}$/)
end
end
end
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