aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-04-15 14:16:42 +1000
committerMatthew Landauer <matthew@openaustralia.org>2013-04-15 14:16:42 +1000
commit183b4f4b67d0f282c43d999bd18e65abca11b41e (patch)
tree83d57c5307f079b56cf486724f03b5606d742a29
parentf847623bc503218df1a1c0b8560bd3edc18ac9d6 (diff)
Test event states when follow up message is sent
-rw-r--r--spec/models/info_request_spec.rb24
1 files changed, 24 insertions, 0 deletions
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