module OLE_QA::Framework::String_Factory

Generate random alphabetic, numeric, or alphanumeric strings of a given length

Public Class Methods

alpha(len = 9) click to toggle source
# File lib/data_factory/string_factory.rb, line 22
def alpha(len = 9)
  str(len).upcase
end
alphanumeric(len = 9) click to toggle source
# File lib/data_factory/string_factory.rb, line 30
def alphanumeric(len = 9)
  str_out = String.new
  len.times do
    str_out << (('A'..'Z').to_a + ('0'..'9').to_a).sample
  end
  str_out
end
numeric(len = 9) click to toggle source
# File lib/data_factory/string_factory.rb, line 26
def numeric(len = 9)
  num_str(len)
end
phone() click to toggle source
# File lib/data_factory/string_factory.rb, line 38
def phone
  str_out = '555-'
  str_out << num_str(3)
  str_out << '-'
  str_out << num_str(4)
  str_out
end
price() click to toggle source
# File lib/data_factory/string_factory.rb, line 46
def price
  str = String.new
  str << num_str(sampler(1..3)) << '.' << '00'
end