cirandas.net

ref: master

test/functional/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
require_relative '../test_helper'

class PluginAdminController
  def index
    render :text => 'ok'
  end
end

class PluginAdminControllerTest < ActionController::TestCase

  def setup
    @controller = PluginAdminController.new
  end

  should 'allow user with the required permission to access plugin administration page' do
    create_user_with_permission('testuser', 'edit_environment_features', Environment.default)
    login_as('testuser')
    get :index
    assert_response :success
  end

  should 'forbid access to users that did not have the required permission' do
    create_user('testuser')
    login_as('testuser')
    get :index
    assert_response :forbidden
  end

end