module RspecSupportMethods::Randomizer

Helper methods for ramdom data

Public Instance Methods

rand_date() click to toggle source
# File lib/rspec_support_methods/randomizer.rb, line 16
def rand_date
  year = Time.now.year - 1
  "#{rand_fixnum(1, 28)}-#{rand_fixnum(1, 12)}-#{rand_fixnum(1960, year)}"
end
rand_email(size = 5) click to toggle source
# File lib/rspec_support_methods/randomizer.rb, line 4
def rand_email(size = 5)
  "#{rand_text(size)}@example.com"
end
rand_fixnum(minimum, maximum) click to toggle source
# File lib/rspec_support_methods/randomizer.rb, line 12
def rand_fixnum(minimum, maximum)
  (minimum..maximum).to_a.sample
end
rand_text(size = 5) click to toggle source
# File lib/rspec_support_methods/randomizer.rb, line 8
def rand_text(size = 5)
  ('a'..'z').to_a.sample(size).join
end