aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-06-07 16:33:43 +0100
committerRobin Houston <robin.houston@gmail.com>2012-06-07 16:33:43 +0100
commit117c5034bf7472a6f3366fa4107cdfec13e37aa1 (patch)
tree70b4dd24568e21bd55aec4fd7080e7e04dd40752
parentf3bfe79d884dc35da99ae373813132b33065e60b (diff)
Make test more flexible
Remove another dependency of a test on the aggregate set of test data, part of a long-term programme to make it easier to add test data (and required here because recently-added test data was causing these tests to fail!)
-rw-r--r--spec/models/xapian_spec.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 81c066184..af4089d75 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
@@ -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