diff options
author | Francis Irving <francis@mysociety.org> | 2010-10-09 14:13:30 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-10-09 14:13:30 +0100 |
commit | a3161580ce204afe52d73e6248a5d60cc0e2476e (patch) | |
tree | e260edd4e7a55652ad376b9a3f054db23f51218d /spec/models | |
parent | 80b173271fe86a1f45f84314d69d972eedb3d0e3 (diff) |
Index tags on public bodies.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/xapian_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb index 2ed8e9277..cc319c2d7 100644 --- a/spec/models/xapian_spec.rb +++ b/spec/models/xapian_spec.rb @@ -289,6 +289,30 @@ describe InfoRequest, " when indexing requests by tag" do end end +describe PublicBody, " when indexing authorities by tag" do + fixtures :public_bodies, :incoming_messages, :outgoing_messages, :raw_emails, :comments + + it "should find request by tag, even when changes" do + rebuild_xapian_index + body = public_bodies(:geraldine_public_body) + body.tag_string = 'mice:3' + body.save! + update_xapian_index + + xapian_object = InfoRequest.full_search([PublicBody], "tag:mice", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model] == public_bodies(:geraldine_public_body) + + xapian_object = InfoRequest.full_search([PublicBody], "tag:mice:3", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model] == public_bodies(:geraldine_public_body) + + xapian_object = InfoRequest.full_search([PublicBody], "tag:orangeaardvark", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 0 + end +end + + |