aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-10-09 14:06:45 +0100
committerFrancis Irving <francis@mysociety.org>2010-10-09 14:06:45 +0100
commit269025f66214fae18dda1d0e31f423dbe3ab6583 (patch)
tree604445ac2403a66df6b27fa7b267157a605d3536 /spec/models
parent9f7f967ebe1e11a0f712e035fbbc3a77a005e0f8 (diff)
Index tags on info requests.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/xapian_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index ba1044033..2ed8e9277 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -270,6 +270,25 @@ describe InfoRequest, " when indexing requests by their title" do
end
end
+describe InfoRequest, " when indexing requests by tag" do
+ fixtures :info_request_events, :info_requests, :incoming_messages, :raw_emails, :comments
+
+ it "should find request by tag, even when changes" do
+ rebuild_xapian_index
+ ir = info_requests(:naughty_chicken_request)
+ ir.tag_string = 'bunnyrabbit'
+ ir.save!
+ update_xapian_index
+
+ xapian_object = InfoRequest.full_search([InfoRequestEvent], "tag:bunnyrabbit", 'created_at', true, nil, 100, 1)
+ xapian_object.results.size.should == 1
+ xapian_object.results[0][:model] == info_request_events(:silly_outgoing_message_event)
+
+ xapian_object = InfoRequest.full_search([InfoRequestEvent], "tag:orangeaardvark", 'created_at', true, nil, 100, 1)
+ xapian_object.results.size.should == 0
+ end
+end
+