<commit_before>require 'test_helper'

module Shadmin
  class AdminTest < ActiveSupport::TestCase

		def setup
			@admin ||= build(:admin)
		end

	  def test_validates_email
	  	assert @admin.valid?
	  	@admin.email = 'peter'
	  	assert_not @admin.valid?
	  end

	  def test_validates_password_length_min
	  	assert @admin.valid?
	  	@admin.password = 'a' * 7
	  	assert_not @admin.valid?
	  end

	  def test_validates_password_length_max
	  	assert @admin.valid?
	  	@admin.password = 'a' * 129
	  	assert_not @admin.valid?
	  end

	  def test_validates_email_uniqueness
	  	assert @admin.valid?
	  	new_admin = create(:admin, email: '<EMAIL>')
	  	@admin.email = new_admin.email
	  	assert_not @admin.valid?
	  end
	end
end<commit_msg>Test kaminari :page method in admin model<commit_after>require 'test_helper'

module Shadmin
  class AdminTest < ActiveSupport::TestCase

		def setup
			@admin ||= build(:admin_adam)
		end

	  def test_validates_email
	  	assert @admin.valid?
	  	@admin.email = 'peter'
	  	assert_not @admin.valid?
	  end

	  def test_validates_password_length_min
	  	assert @admin.valid?
	  	@admin.password = 'a' * 7
	  	assert_not @admin.valid?
	  end

	  def test_validates_password_length_max
	  	assert @admin.valid?
	  	@admin.password = 'a' * 129
	  	assert_not @admin.valid?
	  end

	  def test_validates_email_uniqueness
	  	assert @admin.valid?
	  	new_admin = create(:admin, email: '<EMAIL>')
	  	@admin.email = new_admin.email
	  	assert_not @admin.valid?
	  end

	  # Test kaminari :page method
	  def test_page
	  	create_list(:admin, 75)
	  	admins = Shadmin::Admin.page(1)
	  	assert_equal 20, admins.count
	  end
	end
end
{'fraction_non_alphanumeric': 0.09337349397590361, 'fraction_numerical': 0.00783132530120482, 'mean_word_length': 3.3142857142857145, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5811316', 'n_tokens_mistral': 670, 'n_tokens_neox': 588, 'n_words': 131}