diff options
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/errors_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/search_request_spec.rb | 26 | ||||
-rw-r--r-- | spec/integration/view_request_spec.rb | 3 |
3 files changed, 21 insertions, 10 deletions
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb index d03323445..ea9caaf12 100644 --- a/spec/integration/errors_spec.rb +++ b/spec/integration/errors_spec.rb @@ -17,7 +17,7 @@ describe "When rendering errors" do ] before(:each) do - load_raw_emails_data(raw_emails) + load_raw_emails_data ActionController::Base.consider_all_requests_local = false end diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb index d0a457923..61f8df313 100644 --- a/spec/integration/search_request_spec.rb +++ b/spec/integration/search_request_spec.rb @@ -17,8 +17,7 @@ describe "When searching" do ] before(:each) do - emails = raw_emails.clone - load_raw_emails_data(emails) + load_raw_emails_data rebuild_xapian_index end @@ -35,21 +34,34 @@ 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/requests", :query => "bob", :latest_status => ['successful']) - response.body.should include("no results 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 diff --git a/spec/integration/view_request_spec.rb b/spec/integration/view_request_spec.rb index cf1e4ca6c..0787644ff 100644 --- a/spec/integration/view_request_spec.rb +++ b/spec/integration/view_request_spec.rb @@ -17,8 +17,7 @@ describe "When viewing requests" do ] before(:each) do - emails = raw_emails.clone - load_raw_emails_data(emails) + load_raw_emails_data end it "should not make endlessly recursive JSON <link>s" do |