From 183b4f4b67d0f282c43d999bd18e65abca11b41e Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 15 Apr 2013 14:16:42 +1000 Subject: Test event states when follow up message is sent --- spec/models/info_request_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'spec/models/info_request_spec.rb') diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index e78cf100a..adf942518 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -623,6 +623,30 @@ describe InfoRequest do event2.described_state.should == "waiting_response" event2.calculated_state.should == "waiting_response" end + + it "should have sensible events after a normal followup is sent" do + # An initial request is sent + request.log_event('sent', {}) + request.set_described_state('waiting_response') + # A response is received + request.awaiting_description = true + request.log_event("response", {}) + # The request is classified by the requesting user + request.set_described_state("waiting_response") + # A normal follow up is sent + # This is normally done in OutgoingMessage#send_message + request.log_event('followup_sent', {}) + request.set_described_state('waiting_response') + + request.info_request_events.count.should == 3 + event1, event2, event3 = request.info_request_events + event1.described_state.should == "waiting_response" + event1.calculated_state.should == "waiting_response" + event2.described_state.should == "waiting_response" + event2.calculated_state.should == "waiting_response" + event3.described_state.should == "waiting_response" + event3.calculated_state.should == "waiting_response" + end end end end -- cgit v1.2.3