diff options
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/errors_spec.rb | 20 | ||||
-rw-r--r-- | spec/integration/search_request_spec.rb | 14 |
2 files changed, 12 insertions, 22 deletions
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb index 84a44c9c3..c64ca79e8 100644 --- a/spec/integration/errors_spec.rb +++ b/spec/integration/errors_spec.rb @@ -1,18 +1,5 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -module TestCustomStates - def self.included(base) - base.extend(ClassMethods) - end - - module ClassMethods - def theme_extra_states - return ['crotchety'] - end - end -end - - describe "When rendering errors" do fixtures [ :info_requests, @@ -49,11 +36,8 @@ describe "When rendering errors" do end it "should render a 500 for general errors" do ir = info_requests(:naughty_chicken_request) - InfoRequest.send(:include, TestCustomStates) - InfoRequest.class_eval('@@custom_states_loaded = true') - ir.set_described_state("crotchety") - ir.save! - InfoRequest.class_eval('@@custom_states_loaded = false') + # Set an invalid state for the request. Note that update_attribute doesn't run the validations + ir.update_attribute(:described_state, "crotchety") get("/request/#{ir.url_title}") response.code.should == "500" end diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb index 84239f7a3..dcd20c7bd 100644 --- a/spec/integration/search_request_spec.rb +++ b/spec/integration/search_request_spec.rb @@ -13,7 +13,8 @@ describe "When searching" do :comments ] before(:each) do - load_raw_emails_data(raw_emails) + emails = raw_emails.clone + load_raw_emails_data(emails) end it "should not strip quotes from quoted query" do @@ -25,14 +26,19 @@ describe "When searching" do request_via_redirect("post", "/search", :query => 'bob' ) - response.body.should include("One person matching") + response.body.should include("FOI requests") end it "should correctly filter searches for requests" do request_via_redirect("post", "/search/bob/requests") - response.body.should_not include("One person matching") + response.body.should_not include("One person found") response.body.should include("FOI requests 1 to 2 of 2") end + it "should correctly filter searches for users" do + 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") + end it "should correctly filter searches for successful requests" do request_via_redirect("post", "/search", @@ -45,7 +51,7 @@ describe "When searching" do request_via_redirect("post", "/search", :query => "daftest", :request_variety => ['comments']) - response.body.should include("One FOI request matching your search") + response.body.should include("One FOI request found") request_via_redirect("post", "/search", :query => "daftest", |