aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-03-03 11:56:46 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-03-03 11:56:46 +1100
commitd785bf7e0ad702116706672d964e228612d0b797 (patch)
tree70f97b6b341c2927d3b2cd3b9115f40b0f8c0009 /spec/controllers/request_controller_spec.rb
parentd189203172c931d255c685cecd3a10d6f8555fbc (diff)
Can update status when request is old and unclassified
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 005a77f17..fa7c946d5 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1245,6 +1245,7 @@ describe RequestController, "describe_state_requires_admin" do
let (:info_request) { info_requests(:fancy_dog_request) }
before :each do
+ info_request.stub!(:is_old_unclassified?).and_return(false)
InfoRequest.should_receive(:find_by_url_title!).with("info_request").and_return(info_request)
end
@@ -1256,6 +1257,19 @@ describe RequestController, "describe_state_requires_admin" do
post_redirect = PostRedirect.get_last_post_redirect
response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
end
+
+ context "request is old and unclassified" do
+ before (:each) { info_request.stub!(:is_old_unclassified?).and_return(true) }
+
+ it "should redirect to the login page" do
+ post :describe_state_requires_admin, :message => "Something weird happened", :url_title => "info_request"
+
+ # Ugh.
+ post_redirect = PostRedirect.get_last_post_redirect
+ response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
+ end
+ end
+
end
context "logged in as owner of request" do
@@ -1283,6 +1297,16 @@ describe RequestController, "describe_state_requires_admin" do
response.should render_template('user/wrong_user')
end
+ context "request is old and unclassified" do
+ before (:each) { info_request.stub!(:is_old_unclassified?).and_return(true) }
+
+ it "should set the state" do
+ info_request.should_receive(:set_described_state).with("requires_admin", nil, "Something weird happened")
+
+ post :describe_state_requires_admin, :message => "Something weird happened", :url_title => "info_request"
+ end
+ end
+
context "and has admin powers" do
before :each do
user.update_attribute(:admin_level, "super")