Sha256: a4969c056a2154503729776fc1f78cad6b7881574e3c868125362fe58e5c8ca9
Contents?: true
Size: 1.49 KB
Versions: 15
Compression:
Stored size: 1.49 KB
Contents
require 'test_helper' class Kaui::RoleDefinitionsControllerTest < Kaui::FunctionalTestHelper test 'should instantiate RoleDefinition class' do get :new role_definition = assigns(:role_definition) assert_not_nil role_definition assert_instance_of Kaui::RoleDefinition, role_definition assert_response :success end test 'should return an error if no parameter role definition is passed' do post :create role_definition = assigns(:role_definition) assert_nil role_definition assert_equal 'Required parameter missing: role_definition', flash[:error] assert_response :redirect end test 'should create a new role definition' do role_definition = Hash.new role_definition['role'] = 'test' + SecureRandom.base64(9).gsub(/[\/+=]/,'') role_definition['permissions'] = 'account:delete_emails,account:add_emails' post :create, :role_definition => role_definition assert_equal 'Role was successfully created', flash[:notice] assert_response :redirect end test 'should return an error if there is a error while creating role' do role_definition = Hash.new role_definition['role'] = 'test' + SecureRandom.base64(9).gsub(/[\/+=]/,'') role_definition['permissions'] = 'account:delete_emails,account:add_emails' post :create, :role_definition => role_definition, :reason => SecureRandom.base64(4000), :comment => SecureRandom.base64(4000) assert_match 'Error while creating role', flash[:error] assert_response :success end end
Version data entries
15 entries across 15 versions & 1 rubygems