random_string helper function
This commit is contained in:
parent
d913f50cf9
commit
e3a4207827
1 changed files with 5 additions and 0 deletions
|
@ -90,3 +90,8 @@ RSpec.configure do |config|
|
|||
Kernel.srand config.seed
|
||||
=end
|
||||
end
|
||||
|
||||
def random_string(length = 10)
|
||||
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
||||
string = (0...length).map { o[rand(o.length)] }.join
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue