Class: Test::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/authing_ruby/test/helper.rb

Instance Method Summary collapse

Instance Method Details

#randomNumString(n = 6) ⇒ Object

随机数字字符串



11
12
13
# File 'lib/authing_ruby/test/helper.rb', line 11

def randomNumString(n = 6)
	srand.to_s.chars.last(n).join
end

#randomString(length = 6) ⇒ Object

随机字母字符串,默认 6 位长度



5
6
7
8
# File 'lib/authing_ruby/test/helper.rb', line 5

def randomString(length = 6)
	endIndex = length % 26
	('a'..'z').to_a.shuffle[0,endIndex].join
end