diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-09-13 16:22:17 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-09-13 16:22:17 +0100 |
commit | 0ec315c52a731ff149977b9231a15770fa3bd742 (patch) | |
tree | a6a73b67dd3d2129e539350c1a763633eb961aaa /spec/controllers/admin_general_controller_spec.rb | |
parent | 76b4697ae2490fc227ac0f150d07b74bb3ca5fa3 (diff) |
Paginate the timeline to allow it to render in a reasonable amount of time. In order to avoid sorting large numbers of objects in order to get the right order of combined events across the two model types, get the overall order first from the database and then populate the slice we're interested in.
Diffstat (limited to 'spec/controllers/admin_general_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin_general_controller_spec.rb | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/spec/controllers/admin_general_controller_spec.rb b/spec/controllers/admin_general_controller_spec.rb index 820d1e7f3..dc1eb0d97 100644 --- a/spec/controllers/admin_general_controller_spec.rb +++ b/spec/controllers/admin_general_controller_spec.rb @@ -1,18 +1,39 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -describe AdminGeneralController, "when viewing front page of admin interface" do - integrate_views - before { basic_auth_login @request } - - it "should render the front page" do - get :index, :suppress_redirect => 1 - response.should render_template('index') - end +describe AdminGeneralController do + + describe "when viewing front page of admin interface" do + + integrate_views + before { basic_auth_login @request } + + it "should render the front page" do + get :index, :suppress_redirect => 1 + response.should render_template('index') + end + + it "should redirect to include trailing slash" do + get :index + response.should redirect_to(:controller => 'admin_general', + :action => 'index') + end - it "should redirect to include trailing slash" do - get :index - response.should redirect_to(:controller => 'admin_general', - :action => 'index') end + describe 'when viewing the timeline' do + + it 'should assign an array of events in order of descending date to the view' do + get :timeline, :all => 1 + previous_event = nil + previous_event_at = nil + assigns[:events].each do |event, event_at| + if previous_event + (event_at <= previous_event_at).should be_true + end + previous_event = event + previous_event_at = event_at + end + end + + end end |