aboutsummaryrefslogtreecommitdiffstats
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ecb67a3b4..e5a42f1a9 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -77,12 +77,20 @@ def load_file_fixture(file_name)
return content
end
-def rebuild_xapian_index
+def rebuild_xapian_index(terms = true, values = true, texts = true, dropfirst = true)
+ if dropfirst
+ begin
+ ActsAsXapian.readable_init
+ FileUtils.rm_r(ActsAsXapian.db_path)
+ rescue RuntimeError
+ end
+ ActsAsXapian.writable_init
+ end
verbose = false
# safe_rebuild=true, which involves forking to avoid memory leaks, doesn't work well with rspec.
# unsafe is significantly faster, and we can afford possible memory leaks while testing.
safe_rebuild = false
- ActsAsXapian.rebuild_index(["PublicBody", "User", "InfoRequestEvent"].map{|m| m.constantize}, verbose, safe_rebuild)
+ ActsAsXapian.rebuild_index(["PublicBody", "User", "InfoRequestEvent"].map{|m| m.constantize}, verbose, terms, values, texts, safe_rebuild)
end
def update_xapian_index