Module: Platformx::FakerHelpers

Defined in:
lib/platformx/faker.rb

Overview

Faker helpers

Author:

  • Tim Mushen

Instance Method Summary collapse

Instance Method Details

#x_faker_birthdayString

Faker Birthday

Returns:

  • (String)

    fake birthday



71
72
73
# File 'lib/platformx/faker.rb', line 71

def x_faker_birthday()
   return Faker::Time.between(15.years.ago, 5.years.ago)
end

#x_faker_booleanBoolean

Faker Boolean

Returns:

  • (Boolean)

    fake boolean



84
85
86
# File 'lib/platformx/faker.rb', line 84

def x_faker_boolean()
  return Faker::Boolean.boolean(0.2)
end

#x_faker_characters(length: 10) ⇒ String

Faker Chars

Parameters:

  • length (Integer) (defaults to: 10)

    length of the char string

Returns:

  • (String)

    fake char string



107
108
109
# File 'lib/platformx/faker.rb', line 107

def x_faker_characters(length: 10)
  return Faker::Lorem.characters(length)
end

#x_faker_cityString

Faker City

Returns:

  • (String)

    fake city



35
36
37
# File 'lib/platformx/faker.rb', line 35

def x_faker_city()
  return Faker::Address.city
end

#x_faker_emailString

Faker Email

Returns:

  • (String)

    fake email



11
12
13
# File 'lib/platformx/faker.rb', line 11

def x_faker_email()
  return Faker::Internet.safe_email
end

#x_faker_first_nameString

Faker First Name

Returns:

  • (String)

    fake first name



17
18
19
# File 'lib/platformx/faker.rb', line 17

def x_faker_first_name()
  return Faker::Name.first_name
end

#x_faker_full_nameString

Faker Full Name

Returns:

  • (String)

    fake full name



113
114
115
# File 'lib/platformx/faker.rb', line 113

def x_faker_full_name()
  return Faker::Name.name
end

#x_faker_last_nameString

Faker Last Name

Returns:

  • (String)

    fake last name



23
24
25
# File 'lib/platformx/faker.rb', line 23

def x_faker_last_name()
  return Faker::Name.last_name
end

#x_faker_number(length: 2) ⇒ String

Faker Number

Parameters:

  • length (Integer) (defaults to: 2)

    length of the number

Returns:

  • (String)

    fake number



78
79
80
# File 'lib/platformx/faker.rb', line 78

def x_faker_number(length: 2)
  return Faker::Number.number(length)
end

#x_faker_passwordString

Faker Password

Returns:

  • (String)

    fake password



59
60
61
# File 'lib/platformx/faker.rb', line 59

def x_faker_password()
  return Faker::Internet.password
end

#x_faker_phoneString

Faker Phone

Returns:

  • (String)

    fake phone



53
54
55
# File 'lib/platformx/faker.rb', line 53

def x_faker_phone()
  return Faker::PhoneNumber.phone_number
end

#x_faker_priceString

Faker Price

Examples:

x_faker_price # -> 45.5

Returns:

  • (String)

    fake price



100
101
102
# File 'lib/platformx/faker.rb', line 100

def x_faker_price()
  return Faker::Commerce.price
end

#x_faker_range(low: 1, high: 10) ⇒ Integer

Faker Range

Parameters:

  • low (Integer) (defaults to: 1)

    the minimum of the range

  • high (Integer) (defaults to: 10)

    the highest value of the range

Returns:

  • (Integer)

    fake integer between given values



92
93
94
# File 'lib/platformx/faker.rb', line 92

def x_faker_range(low:1, high:10)
  return Faker::Number.between(low, high)
end

#x_faker_stateString

Faker State

Returns:

  • (String)

    fake state



41
42
43
# File 'lib/platformx/faker.rb', line 41

def x_faker_state()
  return Faker::Address.state_abbr
end

#x_faker_street_addressString

Faker Street Address

Returns:

  • (String)

    fake street address



29
30
31
# File 'lib/platformx/faker.rb', line 29

def x_faker_street_address()
  return Faker::Address.street_address
end

#x_faker_uuidString

Faker UUID

Returns:

  • (String)

    fake uuid



65
66
67
# File 'lib/platformx/faker.rb', line 65

def x_faker_uuid()
  return UUIDTools::UUID.random_create
end

#x_faker_zipString

Faker Zip

Returns:

  • (String)

    fake zip



47
48
49
# File 'lib/platformx/faker.rb', line 47

def x_faker_zip()
  return Faker::Address.zip
end