aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorfrancis <francis>2009-08-18 20:51:25 +0000
committerfrancis <francis>2009-08-18 20:51:25 +0000
commit32c1fe80dc3fefc85d27a8465b67084fbd4fe60e (patch)
tree919a1bfef9b8098a04af19cab111cdf10fe32bfb /spec/controllers
parentb7e060461e986a5bedb4c018b44ae3f1f34d7f11 (diff)
Don't allow duplicate followup messages to the same request.
Prevent requests, followups and annotations which have all capitals or all lowercase letters.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/request_controller_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 939061ce8..e8bf5c1fc 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -681,6 +681,18 @@ describe RequestController, "when sending a followup message" do
info_requests(:fancy_dog_request).get_last_response_event.calculated_state.should == 'waiting_clarification'
end
+ it "should give an error if the same followup is submitted twice" do
+ session[:user_id] = users(:bob_smith_user).id
+
+ # make the followup once
+ 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
+ response.should redirect_to(:action => 'show', :url_title => info_requests(:fancy_dog_request).url_title)
+
+ # 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?
+ response.should render_template('show_response')
+ end
end