aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-08-21 10:59:48 +0100
committerLouise Crow <louise.crow@gmail.com>2012-08-21 10:59:48 +0100
commitb8ed99e84120c561bfc9650144c26c5ccada4939 (patch)
treedd9a5c2576da929dad5f14fe9f7a99340f8ef908 /spec/controllers/request_controller_spec.rb
parent396b272c7f77ffe94ec5efb112e88a3c384d2db0 (diff)
Don't pass a page param of less than one through to Xapian, treat it as a param of 1. Fixes #557.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index f91f87323..f7316a2c0 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -114,6 +114,7 @@ describe RequestController, "when listing recent requests" do
assigns[:list_results].size.should == 25
assigns[:show_no_more_than].should == RequestController::MAX_RESULTS
end
+
it "should return 404 for pages we don't want to serve up" do
xap_results = mock_model(ActsAsXapian::Search,
:results => (1..25).to_a.map { |m| { :model => m } },
@@ -123,6 +124,12 @@ describe RequestController, "when listing recent requests" do
}.should raise_error(ActiveRecord::RecordNotFound)
end
+ it 'should not raise an error for a page param of less than zero, but should treat it as
+ a param of 1' do
+ lambda{ get :list, :view => 'all', :page => "-1" }.should_not raise_error
+ assigns[:page].should == 1
+ end
+
end
describe RequestController, "when changing things that appear on the request page" do
@@ -1890,7 +1897,7 @@ describe RequestController, "when reporting a request (logged in)" do
@user = users(:robin_user)
session[:user_id] = @user.id
end
-
+
it "should 404 for non-existent requests" do
lambda {
post :report_request, :url_title => "hjksfdhjk_louytu_qqxxx"