aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/xapian_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-07-02 13:09:06 +0100
committerRobin Houston <robin.houston@gmail.com>2012-07-02 13:09:06 +0100
commitde929cfe8c0f297c9945189f1456bba3908498a1 (patch)
treeb8ddd5f1875723bda896c66084bc438fe6b8c088 /spec/models/xapian_spec.rb
parent84a27578e5e82739e3a6826c5d2d9890edd600a4 (diff)
parenta9f1d84e7810936f7917c8a367b4713ea77554c9 (diff)
Merge branch 'master' into wdtk
Diffstat (limited to 'spec/models/xapian_spec.rb')
-rw-r--r--spec/models/xapian_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 81c066184..195b39eee 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -76,13 +76,13 @@ describe PublicBody, " when indexing requests by body they are to" do
it "should find requests to the body" do
xapian_object = InfoRequest.full_search([InfoRequestEvent], "requested_from:tgq", 'created_at', true, nil, 100, 1)
- xapian_object.results.size.should == 4
+ xapian_object.results.size.should == PublicBody.find_by_url_name("tgq").info_requests.map(&:info_request_events).flatten.size
end
it "should update index correctly when URL name of body changes" do
# initial search
xapian_object = InfoRequest.full_search([InfoRequestEvent], "requested_from:tgq", 'created_at', true, nil, 100, 1)
- xapian_object.results.size.should == 4
+ xapian_object.results.size.should == PublicBody.find_by_url_name("tgq").info_requests.map(&:info_request_events).flatten.size
models_found_before = xapian_object.results.map { |x| x[:model] }
# change the URL name of the body
@@ -96,7 +96,7 @@ describe PublicBody, " when indexing requests by body they are to" do
xapian_object = InfoRequest.full_search([InfoRequestEvent], "requested_from:tgq", 'created_at', true, nil, 100, 1)
xapian_object.results.size.should == 0
xapian_object = InfoRequest.full_search([InfoRequestEvent], "requested_from:gq", 'created_at', true, nil, 100, 1)
- xapian_object.results.size.should == 4
+ xapian_object.results.size.should == PublicBody.find_by_url_name("gq").info_requests.map(&:info_request_events).flatten.size
models_found_after = xapian_object.results.map { |x| x[:model] }
models_found_before.should == models_found_after
@@ -118,7 +118,7 @@ describe PublicBody, " when indexing requests by body they are to" do
xapian_object = InfoRequest.full_search([InfoRequestEvent], "requested_from:gq", 'created_at', true, nil, 100, 1)
xapian_object.results.size.should == 0
xapian_object = InfoRequest.full_search([InfoRequestEvent], "requested_from:" + body.url_name, 'created_at', true, nil, 100, 1)
- xapian_object.results.size.should == 4
+ xapian_object.results.size.should == public_bodies(:geraldine_public_body).info_requests.map(&:info_request_events).flatten.size
models_found_after = xapian_object.results.map { |x| x[:model] }
end
end