aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin_info_request_event_controller_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/admin_info_request_event_controller_spec.rb b/spec/controllers/admin_info_request_event_controller_spec.rb
new file mode 100644
index 000000000..23300a0b8
--- /dev/null
+++ b/spec/controllers/admin_info_request_event_controller_spec.rb
@@ -0,0 +1,41 @@
+# coding: utf-8
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe AdminInfoRequestEventController do
+
+ describe :update do
+
+ describe 'when handling valid data' do
+
+ before do
+ @info_request_event = FactoryGirl.create(:info_request_event)
+ put :update, :id => @info_request_event
+ end
+
+ it 'gets the info request event' do
+ assigns[:info_request_event].should == @info_request_event
+ end
+
+ it 'sets the described and calculated states on the event' do
+ event = InfoRequestEvent.find(@info_request_event.id)
+ event.described_state.should == 'waiting_clarification'
+ event.calculated_state.should == 'waiting_clarification'
+ end
+
+ it 'shows a success notice' do
+ flash[:notice].should == 'Old response marked as having been a clarification'
+ end
+
+ it 'redirects to the request admin page' do
+ response.should redirect_to(admin_request_url(@info_request_event.info_request))
+ end
+ end
+
+ it 'raises an exception if the event is not a response' do
+ @info_request_event = FactoryGirl.create(:sent_event)
+ lambda{ put :update, :id => @info_request_event }.should raise_error
+ end
+
+ end
+
+end