aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorfrancis <francis>2009-06-30 14:28:25 +0000
committerfrancis <francis>2009-06-30 14:28:25 +0000
commita12d270667df81d81f641c88fd924cd5fd99edfd (patch)
tree9e3262a968252530b880e8c95cd983d3a827af59 /spec/controllers/request_controller_spec.rb
parent36141ae5c6fc922f0e45ce8803765031cdb9fbbb (diff)
Use caching that allows pre-authentication.
Add test code for hidden requests. Make super users able to view hidden requests.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 57d092afb..13117506c 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -49,6 +49,15 @@ describe RequestController, "when showing one request" do
get :show, :url_title => info_requests(:naughty_chicken_request).id
response.should redirect_to(:action => 'show', :url_title => info_requests(:naughty_chicken_request).url_title)
end
+
+ it "should not show hidden requests" do
+ ir = info_requests(:fancy_dog_request)
+ ir.prominence = 'hidden'
+ ir.save!
+
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
+ response.should render_template('hidden')
+ end
describe 'when handling an update_status parameter' do
@@ -108,6 +117,22 @@ describe RequestController, "when showing one request" do
response.content_type.should == "text/plain"
response.should have_text(/First hello/)
end
+
+ it "should not download attachments if hidden" do
+ ir = info_requests(:fancy_dog_request)
+ ir.prominence = 'hidden'
+ ir.save!
+ receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)
+
+ get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2
+ response.content_type.should == "text/html"
+ response.should_not have_text(/Second hello/)
+ response.should render_template('request/hidden')
+ get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 3
+ response.content_type.should == "text/html"
+ response.should_not have_text(/First hello/)
+ response.should render_template('request/hidden')
+ end
end
end