aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-07-04 13:45:29 +0100
committerRobin Houston <robin.houston@gmail.com>2012-07-04 13:45:29 +0100
commitd5a43f1aa76c1e0086f08bec9c575d2a41ae9a9b (patch)
tree9c8a851c0f6e26b40be181f705bae582df20c90b /spec/controllers
parent886a8baef232cce37c829137a8b6a625d16b0504 (diff)
Atom feed of request events
We need not only new requests, but new outgoing correspondence of any sort. The idea is that this feed will contain any event that would have triggered an email to be sent to the public body, so can be used as an alternative, equivalent way to stay up-to-date with happenings on WDTK (or the Alaveteli installation of choice).
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/api_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb
index 1f65576b6..39ffae7fc 100644
--- a/spec/controllers/api_controller_spec.rb
+++ b/spec/controllers/api_controller_spec.rb
@@ -260,4 +260,20 @@ describe ApiController, "when using the API" do
# assigns them and changing assignment to an equality
# check, which does not really test anything at all.
end
+
+ it "should show a feed of new request events" do
+ get :body_request_events,
+ :id => public_bodies(:geraldine_public_body).id,
+ :k => public_bodies(:geraldine_public_body).api_key,
+ :feed_type => "atom"
+
+ response.should be_success
+ response.should render_template("api/request_events.atom")
+ assigns[:events].size.should > 0
+ assigns[:events].each do |event|
+ event.info_request.public_body.should == public_bodies(:geraldine_public_body)
+ event.outgoing_message.should_not be_nil
+ event.event_type.should satisfy {|x| ['sent', 'followup_sent', 'resent', 'followup_resent'].include?(x)}
+ end
+ end
end