cirandas.net

ref: master

plugins/send_email/test/functional/send_email_plugin_admin_controller_test.rb


 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
require 'test_helper'

class SendEmailPluginAdminControllerTest < ActionController::TestCase

  def setup
    @admin = create_user('adminplug').person
    @environment = @admin.environment
    @environment.add_admin(@admin)
  end

  should 'deny access to guests and redirect to login' do
    get :index
    assert_response :redirect
    assert_redirected_to :controller => 'account', :action => 'login'
  end

  should 'allow access to admin' do
    login_as @admin.identifier
    get :index
    assert_response :success
  end

  should 'deny access to ordinary users' do
    @user = create_user('normaluser').person
    login_as @user.identifier
    get :index
    assert_response 403
  end

end