diff options
author | francis <francis> | 2008-01-30 22:32:37 +0000 |
---|---|---|
committer | francis <francis> | 2008-01-30 22:32:37 +0000 |
commit | bd74dbad1b173f2d4ef6d8c41c8fbd9325b61aef (patch) | |
tree | 6ed0921d7dad9a7f71cd650ed635aead3cf0ebb6 | |
parent | 4f3a0967da725e447de646b06fbef1c94a31d4be (diff) |
Adding back tests of state setting.
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 53 | ||||
-rw-r--r-- | spec/fixtures/info_requests.yml | 2 | ||||
-rw-r--r-- | todo.txt | 10 |
3 files changed, 38 insertions, 27 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 3d742f7e0..426224e37 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -161,31 +161,34 @@ describe RequestController, "when viewing an individual response" do end end -#describe RequestController, "when classifying an individual response" do -# integrate_views -# fixtures :info_requests, :public_bodies, :users, :incoming_messages, :outgoing_messages # all needed as integrating views -# -# it "should require login" do -# post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1 -# post_redirect = PostRedirect.get_last_post_redirect -# response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token) -# end -# -# it "should not classify response if logged in as wrong user" do -# session[:user_id] = users(:silly_name_user).id -# post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1 -# response.should render_template('user/wrong_user') -# end -# -# it "should successfully classify response if logged in as user controlling request" do -# incoming_messages(:useless_incoming_message).user_classified.should == false -# session[:user_id] = users(:bob_smith_user).id -# post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1 -# response.should redirect_to(:controller => 'request', :action => 'show', :id => info_requests(:fancy_dog_request)) -# incoming_messages(:useless_incoming_message).reload -# incoming_messages(:useless_incoming_message).user_classified.should == true -# end -#end +describe RequestController, "when classifying an individual response" do + integrate_views + fixtures :info_requests, :public_bodies, :users, :incoming_messages, :outgoing_messages # all needed as integrating views + + it "should require login" do + post :describe_state, :incoming_message => { :described_state => "rejected" }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_describe_state => 1 + post_redirect = PostRedirect.get_last_post_redirect + response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token) + end + + it "should not classify response if logged in as wrong user" do + session[:user_id] = users(:silly_name_user).id + post :describe_state, :incoming_message => { :described_state => "rejected" }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_describe_state => 1 + response.should render_template('user/wrong_user') + end + + it "should successfully classify response if logged in as user controlling request" do + info_requests(:fancy_dog_request).awaiting_description.should == true + session[:user_id] = users(:bob_smith_user).id + post :describe_state, :incoming_message => { :described_state => "rejected" }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_describe_state => 1 + response.should redirect_to(:controller => 'help', :action => 'unhappy') + info_requests(:fancy_dog_request).reload + info_requests(:fancy_dog_request).awaiting_description.should == false + end + + #response.should redirect_to(:controller => 'request', :action => 'show', :id => info_requests(:fancy_dog_request)) + #incoming_messages(:useless_incoming_message).user_classified.should == true +end describe RequestController, "when sending a followup message" do integrate_views diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml index fbd964603..3fc3ea7f4 100644 --- a/spec/fixtures/info_requests.yml +++ b/spec/fixtures/info_requests.yml @@ -7,7 +7,7 @@ fancy_dog_request: user_id: 1 described_state: awaiting_response awaiting_description: true - described_last_incoming_message_id: 1 + described_last_incoming_message_id: nil naughty_chicken_request: id: 103 title: How much public money is wasted on breeding naughty chickens? @@ -4,6 +4,14 @@ hack storing better info so know when state changed for stats purpose, and for R how do we change the state when a follow up is sent? +describe_state post should store and check include message was up to? + +Adam's woes: +http://foi.mysociety.org/request/18/response/31 +- Renders badly +- No doubt leaks email address via download.bin :( +- We don't have "this is an evil techy weird bounce" as option for state of message + FOI requests to use to test it ============================== @@ -28,7 +36,7 @@ Status of messages stuff Add - response was made in private state -Sort out state vs. status vs. describe +Sort out state vs. status vs. describe vs. classify Use sent again date when there has been resent?, e.g. for http://foi.mysociety.org/request/16 |