aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/admin_general_controller_spec.rb
blob: 9719607624931bab978de0d65da6dabc3c4f39ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe AdminGeneralController do

    describe "when viewing front page of admin interface" do

        render_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 admin_general_index_url(:trailing_slash => true)
        end

    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