Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/faker/default/avatar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class << self
#
# @faker.version 1.4.3
def image(slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/
raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)

slug ||= Faker::Lorem.words.join
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/default/lorem_flickr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def colorized_image(size: '300x300', color: 'red', search_terms: ['all'], match_
private

def build_url(size, format, search_terms, match_all)
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/

url_parts = ['https://loremflickr.com']
url_parts << format
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/default/placeholdit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def image(size: '300x300', format: 'png', background_color: nil, text_color: nil
background_color = generate_color if background_color == :random
text_color = generate_color if text_color == :random

raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z$/
raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)
raise ArgumentError, "background_color must be a hex value without '#'" unless background_color.nil? || background_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
raise ArgumentError, "text_color must be a hex value without '#'" unless text_color.nil? || text_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
Expand Down