From 166ab8166d571f913a6c1f4522adcc1e88e3becc Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Thu, 15 Dec 2022 15:38:04 +0100 Subject: [PATCH] Remove FillMurray service --- README.md | 3 +- doc/default/fillmurray.md | 10 ------ lib/faker/default/fillmurray.rb | 36 --------------------- test/faker/default/test_faker_fillmurray.rb | 35 -------------------- 4 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 doc/default/fillmurray.md delete mode 100644 lib/faker/default/fillmurray.rb delete mode 100644 test/faker/default/test_faker_fillmurray.rb diff --git a/README.md b/README.md index 63b47a2c22..d40992a562 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ Faker::Config.locale = :es Note: Overriding the default locale might not be thread-safe. See [Locale setting can be ignored #2563](https://github.com/faker-ruby/faker/issues/2563) for more details. -To override Faker's locales, +To override Faker's locales, check out the [locales README](lib/locales/README.md). ### Minitest and Faker >= 2.22 @@ -258,7 +258,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main - [Faker::Emotion](doc/default/emotion.md) - [Faker::Esport](doc/default/esport.md) - [Faker::File](doc/default/file.md) - - [Faker::Fillmurray](doc/default/fillmurray.md) - [Faker::Finance](doc/default/finance.md) - [Faker::Food](doc/default/food.md) - [Faker::FunnyName](doc/default/funny_name.md) diff --git a/doc/default/fillmurray.md b/doc/default/fillmurray.md deleted file mode 100644 index b71bb478b6..0000000000 --- a/doc/default/fillmurray.md +++ /dev/null @@ -1,10 +0,0 @@ -# Faker::Fillmurray - -Available since version 1.7.1. - -```ruby -# Keyword arguments: grayscale, width, height -Faker::Fillmurray.image #=> "http://www.fillmurray.com/300/300" -Faker::Fillmurray.image(grayscale: true) #=> "http://fillmurray.com/g/300/300" -Faker::Fillmurray.image(grayscale: false, width: 200, height: 400) #=> "http://fillmurray.com/200/400" -``` diff --git a/lib/faker/default/fillmurray.rb b/lib/faker/default/fillmurray.rb deleted file mode 100644 index f0c1cfb5d0..0000000000 --- a/lib/faker/default/fillmurray.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module Faker - class Fillmurray < Base - class << self - ## - # Produces the URL of an image from Fill Murray, a site which hosts - # exclusively photographs of actor Bill Murray. - # - # @param grayscale [Boolean] Whether to return a grayscale image. - # @param width [Integer] The iamage width. - # @param height [Integer] The image height. - # @return [String] - # - # @example - # Faker::Fillmurray.image #=> "https://www.fillmurray.com/300/300" - # - # @example - # Faker::Fillmurray.image(grayscale: true) - # #=> "https://fillmurray.com/g/300/300" - # - # @example - # Faker::Fillmurray.image(grayscale: false, width: 200, height: 400) - # #=> "https://fillmurray.com/200/400" - # - # @faker.version 1.7.1 - def image(grayscale: false, width: 200, height: 200) - raise ArgumentError, 'Width should be a number' unless width.to_s =~ /^\d+$/ - raise ArgumentError, 'Height should be a number' unless height.to_s =~ /^\d+$/ - raise ArgumentError, 'Grayscale should be a boolean' unless [true, false].include?(grayscale) - - "https://www.fillmurray.com#{'/g' if grayscale == true}/#{width}/#{height}" - end - end - end -end diff --git a/test/faker/default/test_faker_fillmurray.rb b/test/faker/default/test_faker_fillmurray.rb deleted file mode 100644 index 56b6aaa984..0000000000 --- a/test/faker/default/test_faker_fillmurray.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../test_helper' - -class TestFakerFillmurray < Test::Unit::TestCase - def setup - @tester = Faker::Fillmurray - end - - def test_fillmurray - refute_nil @tester.image(grayscale: false, width: '300', height: '300').match(%r{https://www\.fillmurray\.com/(\d+)/(\d+)}) - end - - def test_fillmurray_with_grayscale - assert_equal('g/', @tester.image(grayscale: true, width: '300', height: '300').match(%r{https://www\.fillmurray\.com/(g?/?)(\d+)/(\d+)})[1]) - end - - def test_fillmurray_with_incorrect_height_format - assert_raise ArgumentError do - @tester.image(grayscale: false, width: '300', height: 'nine-thousand') - end - end - - def test_fillmurray_with_incorrect_width_format - assert_raise ArgumentError do - @tester.image(grayscale: false, width: 'three-hundred') - end - end - - def test_fillmurray_with_incorrect_grayscale - assert_raise ArgumentError do - @tester.image(grayscale: 'gray', width: '300', height: '400') - end - end -end