Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate LoremPixel #2590

3 changes: 3 additions & 0 deletions lib/faker/default/lorem_pixel.rb
Expand Up @@ -3,6 +3,8 @@
module Faker
class LoremPixel < Base
class << self
extend Gem::Deprecate

SUPPORTED_CATEGORIES = %w[abstract
animals
business
Expand Down Expand Up @@ -55,6 +57,7 @@ def image(size: '300x300', is_gray: false, category: nil, number: nil, text: nil
url_parts += [category, number, text].compact
url_parts.join('/')
end
deprecate :image, 'Faker::LoremFlickr.image', 2022, 12
# rubocop:enable Metrics/ParameterLists
end
end
Expand Down
8 changes: 8 additions & 0 deletions test/faker/default/test_lorem_pixel.rb
Expand Up @@ -7,6 +7,14 @@ def setup
@tester = Faker::LoremPixel
end

def test_image_deprecation_message
_out, err = capture_output do
@tester.image(size: '3x3')
end

assert_match(/Faker::LoremPixel.image is deprecated; use Faker::LoremFlickr.image instead\./, err)
end

def test_lorempixel
refute_nil @tester.image.match(%r{https://lorempixel\.com/(\d+/\d+)})[1]
end
Expand Down