Sha256: 957ea3b100f7dd5c378e9d97f80f3e4651cc65028c90e1c4b7c6dcd7835463c9

Contents?: true

Size: 952 Bytes

Versions: 15

Compression:

Stored size: 952 Bytes

Contents

require File.expand_path(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
    users(:quentin).add_role(:refinery)
    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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
refinerycms-0.9.7.15 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.14 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.13 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.11 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.10 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.9 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.8 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.7 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.6 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.5 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.4 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.3 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.2 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7.1 test/functional/dashboard_controller_test.rb
refinerycms-0.9.7 test/functional/dashboard_controller_test.rb