diff options
-rw-r--r-- | app/controllers/general_controller.rb | 5 | ||||
-rw-r--r-- | spec/controllers/general_controller_spec.rb | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 438bbfd3f..380da285e 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -15,6 +15,11 @@ class GeneralController < ApplicationController def frontpage medium_cache @locale = self.locale_from_params() + successful_query = InfoRequestEvent.make_query_from_params( :latest_status => ['successful'] ) + @track_thing = TrackThing.create_track_for_search_query(successful_query) + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), + :title => _('Successful requests'), + :has_json => true } ] end # Display blog entries diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index 128a42556..ae8d4f256 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -102,6 +102,14 @@ describe GeneralController, "when showing the frontpage" do end end + it 'should generate a feed URL for successful requests' do + get :frontpage + assigns[:feed_autodetect].size.should == 1 + successful_request_feed = assigns[:feed_autodetect].first + successful_request_feed[:title].should == 'Successful requests' + end + + it "should render the front page with default language and ignore the browser setting" do config = MySociety::Config.load_default() config['USE_DEFAULT_BROWSER_LANGUAGE'] = false |