aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-03-02 11:02:59 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-03-02 14:20:36 +1100
commitf52554c212e32bb2ff37abfb58d7eecdcd8d4cee (patch)
tree3dfd1de99f803c7d31ac71f3558da00ffd74a73e
parent9d32b11bca733ed95308fcd7c129c209c87fb8f2 (diff)
Test for situation where request changes while user is looking at it and they change the status
-rw-r--r--spec/controllers/request_controller_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index f4c501018..fbd0c5ec5 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1456,6 +1456,16 @@ describe RequestController, "when classifying an information request" do
flash[:error].should == _("Please choose whether or not you got some of the information that you wanted.")
end
+ it "should not change the status if the request has changed while viewing it" do
+ @dog_request.stub!(:last_event_id_needing_description).and_return(2)
+
+ post :describe_state, :incoming_message => { :described_state => "rejected" },
+ :id => @dog_request.id, :last_info_request_event_id => 1,
+ :submitted_describe_state => 1
+ response.should redirect_to request_url(@dog_request)
+ flash[:error].should =~ /The request has been updated since you originally loaded this page/
+ end
+
it "should successfully classify response if logged in as user controlling request" do
post_status('rejected')
response.should redirect_to(:controller => 'help', :action => 'unhappy', :url_title => @dog_request.url_title)