diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-01-08 14:09:41 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-01-13 17:22:11 +0000 |
commit | 1488f24e3f03fe46b222fa2fca4ae273d0b46ebf (patch) | |
tree | 5ba51d3842064945cd9c49fed9b7b83a8f158a09 /spec/controllers/request_controller_spec.rb | |
parent | 5fb5ec9b8d303d1f5766ecdbbd01e1093ba744dd (diff) |
Add a “Back to search results” link
Store the search parameters in the flash when a search is made via the
select_authority_path page. Stores the parameters for both POST and
AJAX typeahead searches.
The presence of stored search params renders the link on the
PublicBodyController#show template.
“keep”s the search params in PublicBodyController#show so that if the
user clicks the browser’s back button the “Back to search results” link
can still be rendered on the next search result they click.
“keep”s all flash keys in ServicesController#other_country_message
as it’s called through AJAX and ends up sweeping the flash. [1]
[1] More details about this:
http://mikenaberezny.com/2007/09/08/keep-the-flash-and-test-it-too/
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 2d3ccfa63..1a2992611 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -956,6 +956,20 @@ describe RequestController, "when searching for an authority" do }.should_not raise_error(StandardError) end end + + it "remembers the search params" do + session[:user_id] = @user.id + search_params = { + 'query' => 'Quango', + 'page' => '1', + 'bodies' => '1' + } + + get :select_authority, search_params + + expect(flash[:search_params]).to eq(search_params) + end + end describe RequestController, "when creating a new request" do |