lib/fakeit/openapi/example/string_example.rb in fakeit-0.3.0 vs lib/fakeit/openapi/example/string_example.rb in fakeit-0.3.1
- old
+ new
@@ -16,12 +16,12 @@
RANDOM_FORMAT_HANDLERS = {
'uri' => -> { Faker::Internet.url },
'uuid' => -> { SecureRandom.uuid },
'guid' => -> { SecureRandom.uuid },
'email' => -> { Faker::Internet.email },
- 'date' => -> { Faker::Date.backward(100).iso8601 },
- 'date-time' => -> { Faker::Time.backward(100).iso8601 }
+ 'date' => -> { Faker::Date.backward(days: 100).iso8601 },
+ 'date-time' => -> { Faker::Time.backward(days: 100).iso8601 }
}.freeze
def string_example(example_options)
if example_options[:use_static][type: 'string', property: example_options[:property]]
static_string_example
@@ -70,11 +70,11 @@
def length_constraint
minLength || maxLength
end
def string_with_length
- Faker::Internet.user_name(min_string_length..max_string_length)
+ Faker::Internet.username(specifier: min_string_length..max_string_length)
end
def min_string_length
minLength || 0
end
@@ -86,10 +86,10 @@
def random_string_format
(RANDOM_FORMAT_HANDLERS[format] || method(:unknown_format))[]
end
def unknown_format
- Fakeit::Logger.warn("Unknown string format: #{format}")
+ Fakeit::Logger.info("Unknown string format: #{format}")
'Unknown string format'
end
end
end
end