aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/search_request_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-02-03 13:38:59 +0000
committerRobin Houston <robin.houston@gmail.com>2012-02-03 13:38:59 +0000
commit44bb96d40758f3b8bb9da20e3037ff2f04e81327 (patch)
tree2f43c9c02205fec1fb68cdcb66735d5b1ee3172f /spec/integration/search_request_spec.rb
parent7ed887f0989425d9e412890800df05637b08c025 (diff)
parent14b5be69dc2dc3c4dd817feb0b5a8402fc343db4 (diff)
Merge branch 'release/0.5'
Diffstat (limited to 'spec/integration/search_request_spec.rb')
-rw-r--r--spec/integration/search_request_spec.rb49
1 files changed, 24 insertions, 25 deletions
diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb
index 07839af32..b62f0a4c4 100644
--- a/spec/integration/search_request_spec.rb
+++ b/spec/integration/search_request_spec.rb
@@ -2,23 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "When searching" do
- fixtures [
- :users,
- :public_bodies,
- :public_body_translations,
- :public_body_versions,
- :info_requests,
- :raw_emails,
- :outgoing_messages,
- :incoming_messages,
- :comments,
- :info_request_events,
- :track_things,
- ]
-
before(:each) do
- emails = raw_emails.clone
- load_raw_emails_data(emails)
+ load_raw_emails_data
+ rebuild_xapian_index
end
it "should not strip quotes from quoted query" do
@@ -34,33 +20,46 @@ describe "When searching" do
end
it "should correctly filter searches for requests" do
- request_via_redirect("post", "/search/bob/requests")
+ request_via_redirect("post", "/search/bob/requests")
response.body.should_not include("One person found")
- response.body.should include("FOI requests 1 to 2 of 2")
+ n = 4 # The number of requests that contain the word "bob" somewhere
+ # in the email text. At present this is:
+ # - fancy_dog_request
+ # - naughty_chicken_request
+ # - boring_request
+ # - another_boring_request
+ #
+ # In other words it is all requests made by Bob Smith
+ # except for badger_request, which he did not sign.
+ response.body.should include("FOI requests 1 to #{n} of #{n}")
end
it "should correctly filter searches for users" do
- request_via_redirect("post", "/search/bob/users")
+ request_via_redirect("post", "/search/bob/users")
response.body.should include("One person found")
- response.body.should_not include("FOI requests 1 to 2 of 2")
+ response.body.should_not include("FOI requests 1 to")
end
it "should correctly filter searches for successful requests" do
- request_via_redirect("post", "/search",
+ request_via_redirect("post", "/search/requests",
:query => "bob",
:latest_status => ['successful'])
- response.body.should include("no requests matching your query")
+ n = 2 # The number of *successful* requests that contain the word "bob" somewhere
+ # in the email text. At present this is:
+ # - boring_request
+ # - another_boring_request
+ response.body.should include("FOI requests 1 to #{n} of #{n}")
end
it "should correctly filter searches for comments" do
- request_via_redirect("post", "/search",
+ request_via_redirect("post", "/search/requests",
:query => "daftest",
:request_variety => ['comments'])
response.body.should include("One FOI request found")
- request_via_redirect("post", "/search",
+ request_via_redirect("post", "/search/requests",
:query => "daftest",
:request_variety => ['response','sent'])
- response.body.should include("no requests matching your query")
+ response.body.should include("no results matching your query")
end
end