diff options
-rw-r--r-- | app/controllers/request_controller.rb | 19 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 10 | ||||
-rw-r--r-- | spec/fixtures/info_requests.yml | 5 |
3 files changed, 17 insertions, 17 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 347838827..05affaf67 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.14 2007-11-09 02:11:35 francis Exp $ +# $Id: request_controller.rb,v 1.15 2007-11-13 12:47:05 francis Exp $ class RequestController < ApplicationController @@ -55,21 +55,8 @@ class RequestController < ApplicationController else # do nothing - as "authenticated?" has done the redirect to signin page for us end + end - # Save both models # XXX still fiddling with error reporting here, see Louise's - # email about some better error reporting plugin. -# valid = @info_request.valid? -# valid &&= @outgoing_message.valid? # XXX maybe there is a nicer way of preventing lazy boolean evaluation than this -# if valid -# if authenticated? -# @info_request.save! -# @outgoing_message.save! -# end -# else -# render :action => 'index' -# end - end - - private + private end diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 9c0997569..bca0a2a57 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -48,7 +48,8 @@ describe RequestController, "when listing all requests" do end describe RequestController, "when showing one request" do - fixtures :info_requests + integrate_views + fixtures :info_requests, :public_bodies, :users # all needed as integrating views it "should be successful" do get :show, :id => 101 @@ -64,6 +65,13 @@ describe RequestController, "when showing one request" do get :show, :id => 101 assigns[:info_request].should == info_requests(:fancy_dog_request) end + + it "should show incoming messages" do + ir = info_requests(:fancy_dog_request) + receive_incoming_mail('incoming-request-plain.email', ir.incoming_email) + get :show, :id => 101 + assigns[:correspondences].size.should == 1 + end end # XXX do this for invalid ids diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml index 3bb7934ac..53a325caa 100644 --- a/spec/fixtures/info_requests.yml +++ b/spec/fixtures/info_requests.yml @@ -3,9 +3,14 @@ fancy_dog_request: title: Why do you have such a fancy dog? created_at: 2007-10-11 18:15:57 updated_at: 2007-10-11 18:15:57 + public_body_id: 2 + user_id: 1 naughty_chicken_request: id: 103 title: How much public money is wasted on breeding naughty chickens? created_at: 2007-10-13 18:15:57 updated_at: 2007-10-13 18:15:57 + public_body_id: 2 + user_id: 1 + |