aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/info_request_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-08-07 14:45:27 +0100
committerLouise Crow <louise.crow@gmail.com>2013-08-15 10:12:04 +0100
commite709bfe80409a88dbfae7b62916781ac3ebd6f0b (patch)
treeaa35ca9f645529bc393327d3040746fe61a01266 /spec/models/info_request_spec.rb
parente2154bdf9f5b4e389da50e6a073772aa3f59d11d (diff)
Make admin edits affect info_request_event described_states.
Make sure that admin edits changing the described state of an info request are reflected in the latest_status and status values of info request events so that the info requests are retrieved correctly in status-based searches.
Diffstat (limited to 'spec/models/info_request_spec.rb')
-rw-r--r--spec/models/info_request_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index a63da01db..3451e018f 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -834,6 +834,27 @@ describe InfoRequest do
events[2].calculated_state.should == "successful"
end
end
+
+ context "another series of events on a request", :focus => true do
+ it "should have sensible event states" do
+ # An initial request is sent
+ request.log_event('sent', {})
+ request.set_described_state('waiting_response')
+ # An admin sets the status of the request to 'gone postal' using
+ # the admin interface
+ request.log_event("edit", {})
+ request.set_described_state("gone_postal")
+
+ events = request.info_request_events
+ events.count.should == 2
+ events[0].event_type.should == "sent"
+ events[0].described_state.should == "waiting_response"
+ events[0].calculated_state.should == "waiting_response"
+ events[1].event_type.should == "edit"
+ events[1].described_state.should == "gone_postal"
+ events[1].calculated_state.should == "gone_postal"
+ end
+ end
end
end
end