<commit_before>require 'test_helper'

class SimplyAuthorized::RolesControllerTest < ActionController::TestCase
	tests RolesController
#class RolesControllerTest < ActionController::TestCase

	#	no user_id
	assert_no_route(:put, :update, :id => 'reader')
	assert_no_route(:delete, :destroy, :id => 'reader')

%w( super_user admin ).each do |cu|

	test "should update with #{cu} login" do
		login_as send(cu)
		u = active_user
		assert !u.reload.role_names.include?('reader')
		assert_difference("User.find(#{u.id}).roles.length",1){
			put :update, :user_id => u.id, :id => 'reader'
		}
		assert  u.reload.role_names.include?('reader')
		assert_not_nil flash[:notice]
		assert_redirected_to user_path(assigns(:user))
	end<commit_msg>Moved simply_authorized functional tests into own namespace.<commit_after>require 'test_helper'

class SimplyAuthorized::RolesControllerTest < ActionController::TestCase
	tests RolesController

	#	no user_id
	assert_no_route(:put, :update, :id => 'reader')
	assert_no_route(:delete, :destroy, :id => 'reader')

%w( super_user admin ).each do |cu|

	test "should update with #{cu} login" do
		login_as send(cu)
		u = active_user
		assert !u.reload.role_names.include?('reader')
		assert_difference("User.find(#{u.id}).roles.length",1){
			put :update, :user_id => u.id, :id => 'reader'
		}
		assert  u.reload.role_names.include?('reader')
		assert_not_nil flash[:notice]
		assert_redirected_to user_path(assigns(:user))
	end
{'fraction_non_alphanumeric': 0.140893470790378, 'fraction_numerical': 0.0013745704467353953, 'mean_word_length': 5.933333333333334, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5042177', 'n_tokens_mistral': 522, 'n_tokens_neox': 495, 'n_words': 108}