Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 21d94fad86
Fetching contributors…

Cannot retrieve contributors at this time

file 40 lines (28 sloc) 0.894 kb
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 39 40
require File.dirname(__FILE__) + '/../test_helper'
require 'admin/dashboard_controller'

class Admin::DashboardController; def rescue_action(e) raise e end; end

class DashboardControllerTest < ActionController::TestCase

  fixtures :users, :pages

  def setup
    @controller = Admin::DashboardController.new
    login_as(:quentin)
  end

  def test_should_get_index
    get :index
    assert_response :success

    assert_not_nil assigns(:recent_activity)
  end

  def test_recent_activity_should_report_activity
    sleep 1
    pages(:home_page).update_attribute(:updated_at, Time.now)

    get :index

    # now the home page is updated is it at the top?
    assert_equal pages(:home_page).id, assigns(:recent_activity).first.id
  end

  def test_should_require_login_and_redirect
    logout

    get :index
    assert_response :redirect
    assert_nil assigns(:recent_activity)
  end

end
Something went wrong with that request. Please try again.