aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-08-29 14:55:33 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-08-29 14:56:00 +0100
commite57fa3d276d700ea21c97f8c2d3731f0f9d4c7ab (patch)
tree1c9e555bde2d3b1a2007841f02ae62b3c3520b37 /spec/controllers/request_controller_spec.rb
parent3084034493a428b2394a59b68921ed4b73a8cf7e (diff)
parentb4aefe5a69bbd492959931f1c577a028ec361993 (diff)
Attempt to merge current develop to theme
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index f69cf414c..2b153ac7a 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1,7 +1,3 @@
-# £2k p/a
-# talk about margins
-#
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
@@ -24,13 +20,29 @@ describe RequestController, "when listing recent requests" do
response.should render_template('list')
end
+ it "should filter requests" do
+ get :list, :view => 'all'
+ assigns[:list_results].size.should == 2
+ get :list, :view => 'successful'
+ assigns[:list_results].size.should == 0
+ end
+
+ it "should filter requests by date" 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
+ end
+
it "should assign the first page of results" do
xap_results = mock_model(ActsAsXapian::Search,
:results => (1..25).to_a.map { |m| { :model => m } },
:matches_estimated => 103)
InfoRequest.should_receive(:full_search).
- with([InfoRequestEvent],"variety:sent", "created_at", anything, anything, anything, anything).
+ with([InfoRequestEvent]," variety:sent", "created_at", anything, anything, anything, anything).
and_return(xap_results)
get :list, :view => 'recent'
assigns[:list_results].size.should == 25