aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/admin_request_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-05-28 14:45:30 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-05-28 14:45:30 +0100
commite319d6c89acfad45f443a1a66c2b1bcf2672731c (patch)
tree81fa3f7cd88759e19fb7306698b674a8aace0c1b /spec/controllers/admin_request_controller_spec.rb
parentc81ab0b1982107f1c5e4793e6e903975c867b928 (diff)
parent084cc18aa872b3cd1cbc8c38d34dc17341472391 (diff)
Merge branch 'feature/easy-request-hiding-for-admin' into develop
Diffstat (limited to 'spec/controllers/admin_request_controller_spec.rb')
-rw-r--r--spec/controllers/admin_request_controller_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index ece1fe389..c6e3f2572 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -110,4 +110,26 @@ describe AdminRequestController, "when administering the holding pen" do
assert_equal File.exists?(raw_email), false
end
+ it "shows a suitable default 'your email has been hidden' message" do
+ ir = info_requests(:fancy_dog_request)
+ get :show, :id => ir.id
+ assigns[:request_hidden_user_explanation].should include(ir.user.name)
+ assigns[:request_hidden_user_explanation].should include("vexatious")
+ get :show, :id => ir.id, :reason => "not_foi"
+ assigns[:request_hidden_user_explanation].should_not include("vexatious")
+ assigns[:request_hidden_user_explanation].should include("not a valid FOI")
+ end
+
+ it "hides requests and sends a notification email that it has done so" do
+ ir = info_requests(:fancy_dog_request)
+ post :hide_request, :id => ir.id, :explanation => "Foo", :reason => "vexatious"
+ ir.reload
+ ir.prominence.should == "requester_only"
+ ir.described_state.should == "vexatious"
+ deliveries = ActionMailer::Base.deliveries
+ deliveries.size.should == 1
+ mail = deliveries[0]
+ mail.body.should =~ /Foo/
+ end
+
end