diff options
author | Francis Irving <francis@mysociety.org> | 2010-06-16 17:29:46 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-06-16 17:29:46 +0100 |
commit | a6af93c9f8f297e6fc15eee143db50341c76af29 (patch) | |
tree | 41ee5750821e03ed0a7b115111767b81e9b8aa89 | |
parent | fd4ddb8a2f9ea0ad5982670c2d983b740e7733f9 (diff) |
Test deleting public body from Xapian
-rw-r--r-- | spec/models/xapian_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb index 9c5f2121b..c2a87b969 100644 --- a/spec/models/xapian_spec.rb +++ b/spec/models/xapian_spec.rb @@ -31,6 +31,20 @@ describe PublicBody, " when indexing public bodies with Xapian" do xapian_object.results[0][:model].should == public_bodies(:humpadink_public_body) end + it "should delete public bodies from the index when they are deleted" do + rebuild_xapian_index + + xapian_object = InfoRequest.full_search([PublicBody], "albatross", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 1 + xapian_object.results[0][:model].should == public_bodies(:humpadink_public_body) + + public_bodies(:humpadink_public_body).delete + + update_xapian_index + xapian_object = InfoRequest.full_search([PublicBody], "albatross", 'created_at', true, nil, 100, 1) + xapian_object.results.size.should == 0 + end + end describe PublicBody, " when indexing requests by body they are to" do |