diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-01-13 17:23:02 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-01-13 17:23:02 +0000 |
commit | af18834097e2f49ba9c0e18b9dac42cbc6eb1ebd (patch) | |
tree | 9d6301576c5b0733d1a988860f9a08e979442484 /spec/controllers/public_body_controller_spec.rb | |
parent | 74f325825c3a5b94794253009a10f002dac3fa39 (diff) | |
parent | 1488f24e3f03fe46b222fa2fca4ae273d0b46ebf (diff) |
Merge branch '2051-back-to-search' into rails-3-develop
Diffstat (limited to 'spec/controllers/public_body_controller_spec.rb')
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 840b4bb28..130631ef6 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -70,6 +70,18 @@ describe PublicBodyController, "when showing a body" do get :show, :url_name => "dFh", :view => 'all' response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh") end + + it 'keeps the search_params flash' do + # Make two get requests to simulate the flash getting swept after the + # first response. + search_params = { 'query' => 'Quango' } + get :show, { :url_name => 'dfh', :view => 'all' }, + nil, + { :search_params => search_params } + get :show, :url_name => 'dfh', :view => 'all' + expect(flash[:search_params]).to eq(search_params) + end + end describe PublicBodyController, "when listing bodies" do @@ -479,4 +491,15 @@ describe PublicBodyController, "when doing type ahead searches" do response.should render_template('public_body/_search_ahead') assigns[:xapian_requests].should be_nil end + + it 'remembers the search params' do + search_params = { + 'query' => 'Quango', + 'page' => '1', + 'bodies' => '1' + } + get :search_typeahead, search_params + expect(flash[:search_params]).to eq(search_params) + end + end |