aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb36
1 files changed, 23 insertions, 13 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 9353efcb3..f7c935af3 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -77,7 +77,7 @@ describe RequestController, "when changing things that appear on the request pag
PurgeRequest.all().count.should == 0
end
it "should purge the downstream cache when censor rules have changed" do
- # XXX really, CensorRules should execute expiry logic as part
+ # TODO: really, CensorRules should execute expiry logic as part
# of the after_save of the model. Currently this is part of
# the AdminCensorRuleController logic, so must be tested from
# there. Leaving this stub test in place as a reminder
@@ -643,7 +643,7 @@ describe RequestController, "when showing one request" do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)
- # XXX this is horrid, but don't know a better way. If we
+ # TODO: this is horrid, but don't know a better way. If we
# don't do this, the info_request_event to which the
# info_request is attached still uses the unmodified
# version from the fixture.
@@ -900,7 +900,7 @@ describe RequestController, "when handling prominence" do
end
-# XXX do this for invalid ids
+# TODO: do this for invalid ids
# it "should render 404 file" do
# response.should render_template("#{Rails.root}/public/404.html")
# response.headers["Status"].should == "404 Not Found"
@@ -923,7 +923,6 @@ describe RequestController, "when searching for an authority" do
end
it "should return matching bodies" do
-
session[:user_id] = @user.id
get :select_authority, :query => "Quango"
@@ -1004,7 +1003,18 @@ describe RequestController, "when creating a new request" do
post :new, params
post_redirect = PostRedirect.get_last_post_redirect
response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
- # post_redirect.post_params.should == params # XXX get this working. there's a : vs '' problem amongst others
+ # post_redirect.post_params.should == params # TODO: get this working. there's a : vs '' problem amongst others
+ end
+
+ it 'redirects to the frontpage if the action is sent the invalid
+ public_body param' do
+ post :new, :info_request => { :public_body => @body.id,
+ :title => 'Why Geraldine?',
+ :tag_string => '' },
+ :outgoing_message => { :body => 'This is a silly letter.' },
+ :submitted_new_request => 1,
+ :preview => 1
+ response.should redirect_to frontpage_url
end
it "should show preview when input is good" do
@@ -1793,7 +1803,7 @@ describe RequestController, "when sending a followup message" do
session[:user_id] = users(:bob_smith_user).id
post :show_response, :outgoing_message => { :body => "", :what_doing => 'normal_sort'}, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_followup => 1
- # XXX how do I check the error message here?
+ # TODO: how do I check the error message here?
response.should render_template('show_response')
end
@@ -1843,13 +1853,13 @@ describe RequestController, "when sending a followup message" do
# second time should give an error
post :show_response, :outgoing_message => { :body => "Stop repeating yourself!", :what_doing => 'normal_sort' }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_followup => 1
- # XXX how do I check the error message here?
+ # TODO: how do I check the error message here?
response.should render_template('show_response')
end
end
-# XXX Stuff after here should probably be in request_mailer_spec.rb - but then
+# TODO: Stuff after here should probably be in request_mailer_spec.rb - but then
# it can't check the URLs in the emails I don't think, ugh.
describe RequestController, "sending overdue request alerts" do
@@ -1878,7 +1888,7 @@ describe RequestController, "sending overdue request alerts" do
mail_token = $2
session[:user_id].should be_nil
- controller.test_code_redirect_by_email_token(mail_token, self) # XXX hack to avoid having to call User controller for email link
+ controller.test_code_redirect_by_email_token(mail_token, self) # TODO: hack to avoid having to call User controller for email link
session[:user_id].should == info_requests(:naughty_chicken_request).user.id
response.should render_template('show_response')
@@ -1935,7 +1945,7 @@ describe RequestController, "sending overdue request alerts" do
mail_token = $2
session[:user_id].should be_nil
- controller.test_code_redirect_by_email_token(mail_token, self) # XXX hack to avoid having to call User controller for email link
+ controller.test_code_redirect_by_email_token(mail_token, self) # TODO: hack to avoid having to call User controller for email link
session[:user_id].should == info_requests(:naughty_chicken_request).user.id
response.should render_template('show_response')
@@ -2017,12 +2027,12 @@ describe RequestController, "sending unclassified new response reminder alerts"
mail_token = $2
session[:user_id].should be_nil
- controller.test_code_redirect_by_email_token(mail_token, self) # XXX hack to avoid having to call User controller for email link
+ controller.test_code_redirect_by_email_token(mail_token, self) # TODO: hack to avoid having to call User controller for email link
session[:user_id].should == info_requests(:fancy_dog_request).user.id
response.should render_template('show')
assigns[:info_request].should == info_requests(:fancy_dog_request)
- # XXX should check anchor tag here :) that it goes to last new response
+ # TODO: should check anchor tag here :) that it goes to last new response
end
end
@@ -2053,7 +2063,7 @@ describe RequestController, "clarification required alerts" do
mail_token = $2
session[:user_id].should be_nil
- controller.test_code_redirect_by_email_token(mail_token, self) # XXX hack to avoid having to call User controller for email link
+ controller.test_code_redirect_by_email_token(mail_token, self) # TODO: hack to avoid having to call User controller for email link
session[:user_id].should == info_requests(:fancy_dog_request).user.id
response.should render_template('show_response')