From ec7a0c92f2b09c6b4d4d747d0b492bf9bd45c8ac Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 13 Jan 2012 10:31:23 +0000 Subject: Fix further special character searches as per issue #328 --- spec/controllers/request_controller_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 96786a0a3..a3acd2ff5 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1509,7 +1509,8 @@ describe RequestController, "when doing type ahead searches" do for phrase in ["Marketing/PR activities - Aldborough E-Act Free Schoo", "Request for communications between DCMS/Ed Vaizey and ICO from Jan 1st 2011 - May ", "Bellevue Road Ryde Isle of Wight PO33 2AR - what is the", - "NHS Ayrshire & Arran"] + "NHS Ayrshire & Arran", + "uda ( units of dent"] lambda { get :search_typeahead, :q => phrase }.should_not raise_error(StandardError) -- cgit v1.2.3 From cec2c545e0a10e0641c4ee67839c88d872b394b8 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 13 Jan 2012 11:49:00 +0000 Subject: Ensure we show "all requests" in order that they were last updated. FIxes #343. --- spec/controllers/request_controller_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index a3acd2ff5..18cb354b9 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -24,6 +24,8 @@ describe RequestController, "when listing recent requests" do it "should filter requests" do get :list, :view => 'all' assigns[:list_results].size.should == 2 + # default sort order is the request with the most recently created event first + assigns[:list_results][0].info_request.id.should == 101 get :list, :view => 'successful' assigns[:list_results].size.should == 0 end @@ -32,9 +34,10 @@ describe RequestController, "when listing recent requests" do get :list, :view => 'all', :request_date_before => '13/10/2007' assigns[:list_results].size.should == 1 get :list, :view => 'all', :request_date_after => '13/10/2007' - assigns[:list_results].size.should == 1 - get :list, :view => 'all', :request_date_after => '10/10/2007', :request_date_before => '01/01/2010' assigns[:list_results].size.should == 2 + get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007' + assigns[:list_results].size.should == 2 + end end it "should assign the first page of results" do @@ -43,7 +46,7 @@ describe RequestController, "when listing recent requests" do :matches_estimated => 103) InfoRequest.should_receive(:full_search). - with([InfoRequestEvent]," variety:sent", "created_at", anything, anything, anything, anything). + with([InfoRequestEvent]," variety:sent OR variety:followup_sent OR variety:response OR variety:comment", "created_at", anything, anything, anything, anything). and_return(xap_results) get :list, :view => 'recent' assigns[:list_results].size.should == 25 -- cgit v1.2.3 From 08dd56bac73ce83fcb12e4776b32c4e0ce75545a Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 13 Jan 2012 11:50:21 +0000 Subject: Show internal_review (and some other) items in the "unresolved" list. Fixes #344. --- spec/controllers/request_controller_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 18cb354b9..52fea03b5 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -38,6 +38,16 @@ describe RequestController, "when listing recent requests" do get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007' assigns[:list_results].size.should == 2 end + + it "should list internal_review requests as unresolved ones" do + get :list, :view => 'awaiting' + assigns[:list_results].size.should == 0 + event = info_request_events(:useless_incoming_message_event) + event.calculated_state = "internal_review" + event.save! + rebuild_xapian_index + get :list, :view => 'awaiting' + assigns[:list_results].size.should == 1 end it "should assign the first page of results" do -- cgit v1.2.3 From 07068037e9b0ac8de80a9eae36a323689c83139d Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 13 Jan 2012 13:28:23 +0000 Subject: Fix bug introduced in cec2c545e0a10e0641c4ee67839c88d872b394b8, related to issue #343. --- spec/controllers/request_controller_spec.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 52fea03b5..40cb168f4 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -23,9 +23,9 @@ describe RequestController, "when listing recent requests" do it "should filter requests" do get :list, :view => 'all' - assigns[:list_results].size.should == 2 + assigns[:list_results].size.should == 3 # default sort order is the request with the most recently created event first - assigns[:list_results][0].info_request.id.should == 101 + assigns[:list_results][0].info_request.id.should == 104 get :list, :view => 'successful' assigns[:list_results].size.should == 0 end @@ -34,9 +34,9 @@ describe RequestController, "when listing recent requests" do get :list, :view => 'all', :request_date_before => '13/10/2007' assigns[:list_results].size.should == 1 get :list, :view => 'all', :request_date_after => '13/10/2007' - assigns[:list_results].size.should == 2 + assigns[:list_results].size.should == 3 get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007' - assigns[:list_results].size.should == 2 + assigns[:list_results].size.should == 1 end it "should list internal_review requests as unresolved ones" do @@ -56,7 +56,7 @@ describe RequestController, "when listing recent requests" do :matches_estimated => 103) InfoRequest.should_receive(:full_search). - with([InfoRequestEvent]," variety:sent OR variety:followup_sent OR variety:response OR variety:comment", "created_at", anything, anything, anything, anything). + with([InfoRequestEvent]," (variety:sent OR variety:followup_sent OR variety:response OR variety:comment)", "created_at", anything, anything, anything, anything). and_return(xap_results) get :list, :view => 'recent' assigns[:list_results].size.should == 25 @@ -1124,8 +1124,8 @@ describe RequestController, "sending overdue request alerts" do RequestMailer.alert_overdue_requests deliveries = ActionMailer::Base.deliveries - deliveries.size.should == 1 - mail = deliveries[0] + deliveries.size.should == 2 + mail = deliveries[1] mail.body.should =~ /promptly, as normally/ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email @@ -1152,8 +1152,8 @@ describe RequestController, "sending overdue request alerts" do RequestMailer.alert_overdue_requests deliveries = ActionMailer::Base.deliveries - deliveries.size.should == 1 - mail = deliveries[0] + deliveries.size.should == 2 + mail = deliveries[1] mail.body.should =~ /promptly, as normally/ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email end @@ -1177,8 +1177,8 @@ describe RequestController, "sending overdue request alerts" do RequestMailer.alert_overdue_requests deliveries = ActionMailer::Base.deliveries - deliveries.size.should == 1 - mail = deliveries[0] + deliveries.size.should == 2 + mail = deliveries[1] mail.body.should =~ /required by law/ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email -- cgit v1.2.3