aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/track_controller_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-05-03 18:56:21 +0100
committerRobin Houston <robin.houston@gmail.com>2012-05-04 15:13:37 +0100
commit88d5103ec40120b64a7579994ad2f11334dee71a (patch)
tree5dc543bec817d68a382d37d7dbe3b0eea43b3c1e /spec/controllers/track_controller_spec.rb
parent5344f5dad381698cf4de9361c7a39aefb3eb2e8d (diff)
Filter public body tracks by event type
Add the facility to filter the public body feed by event type using a query string parameter, e.g. event_type=sent.
Diffstat (limited to 'spec/controllers/track_controller_spec.rb')
-rw-r--r--spec/controllers/track_controller_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index 0dc5db607..5d299caa5 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -183,6 +183,35 @@ describe TrackController, "when viewing JSON version of a track feed" do
end
+describe TrackController, "when tracking a public body" do
+ integrate_views
+
+ before(:each) do
+ load_raw_emails_data
+ rebuild_xapian_index
+ end
+
+ it "should work" do
+ geraldine = public_bodies(:geraldine_public_body)
+ get :track_public_body, :feed => 'feed', :url_name => geraldine.url_name
+ response.should be_success
+ response.should render_template('track/atom_feed')
+ tt = assigns[:track_thing]
+ tt.public_body.should == geraldine
+ tt.track_type.should == 'public_body_updates'
+ tt.track_query.should == "requested_from:" + geraldine.url_name
+ end
+ it "should filter by event type" do
+ geraldine = public_bodies(:geraldine_public_body)
+ get :track_public_body, :feed => 'feed', :url_name => geraldine.url_name, :event_type => 'sent'
+ response.should be_success
+ response.should render_template('track/atom_feed')
+ tt = assigns[:track_thing]
+ tt.public_body.should == geraldine
+ tt.track_type.should == 'public_body_updates'
+ tt.track_query.should == "requested_from:" + geraldine.url_name + " variety:sent"
+ end
+end