Sha256: 38f78afe3a012bbefda15d6b3e8c49e59047ac636c621b50998a782f2e04dcf4

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'test/helper'

# Test resources which are not related to an ActiveRecord model.

class Admin::StatusControllerTest < ActionController::TestCase

  def setup
    @typus_user = typus_users(:admin)
    @request.session[:typus_user_id] = @typus_user.id
  end

  def test_should_verify_admin_can_go_to_index
    get :index
    assert_response :success
    assert_template 'index'
  end

  def test_should_verify_status_is_not_available_if_user_not_logged
    @request.session[:typus_user_id] = nil
    get :index
    assert_response :redirect
    assert_redirected_to admin_sign_in_path(:back_to => '/admin/status')
  end

  def test_should_verify_admin_can_not_go_to_show
    get :show
    assert_response :redirect
    assert_redirected_to admin_dashboard_path
    assert flash[:notice]
    assert_equal "#{@typus_user.role.capitalize} can't go to show on status.", flash[:notice]
  end

  def test_should_verify_editor_can_not_go_to_index
    typus_user = typus_users(:editor)
    @request.session[:typus_user_id] = typus_user.id
    get :index
    assert_response :redirect
    assert flash[:notice]
    assert_equal "#{typus_user.role.capitalize} can't go to index on status.", flash[:notice]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typus-0.9.29 test/functional/admin/status_controller_test.rb
typus-0.9.28 test/functional/admin/status_controller_test.rb