From 7990a43171c0ae700ea32659a569e4013e9e929b Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Mon, 26 Feb 2024 10:09:59 -0800 Subject: [PATCH] Fix/Deprecate FmaBrotherhood Generator (#2856) * Favor 'The Room' instead of 'Room' This commit will rename instances of room to the_room including the locales. Originally the `room.md` had a typo that referenced ::Room and not ::TheRoom which is also fixed here. Ref: - https://github.com/faker-ruby/faker/issues/2787 Co-authored-by: Jamal-A-Mohamed Co-authored-by: Salvador * Fix/Deprecate FmaBrotherhood Generator This commit fixes the naming discrpencies with the FmaBrotherhood (now FullmetalAlchemistBrotherhood) class and its filename. This adds deprecation warnings for the old FmaBrotherhood class and also makes the new FullmetalAlchemistBrotherhood class. Fix: - https://github.com/faker-ruby/faker/issues/2853 * Refactor deprecation for `FmaBrotherhood` This commit will refactor the changes from `FmaBrotherhood` to `FullmetalAlchemistBrotherhood` and use `Faker::Deprecator`. --------- Co-authored-by: Jamal-A-Mohamed Co-authored-by: Salvador Co-authored-by: Stefanni Brasil --- README.md | 2 +- .../fullmetal_alchemist_brotherhood.md | 8 +++---- .../fullmetal_alchemist_brotherhood.rb | 23 +++++++++++-------- ...ml => fullmetal_alchemist_brotherhood.yml} | 6 ++--- ...t_faker_fullmetal_alchemist_brotherhood.rb | 18 +++++++++++++++ 5 files changed, 39 insertions(+), 18 deletions(-) rename lib/locales/en/{fma_brotherhood.yml => fullmetal_alchemist_brotherhood.yml} (95%) diff --git a/README.md b/README.md index fa1f055491..02aaa8ce02 100644 --- a/README.md +++ b/README.md @@ -376,7 +376,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main - [Faker::JapaneseMedia::Naruto](doc/japanese_media/naruto.md) - [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md) - [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md) - - [Faker::JapaneseMedia::FmaBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md) + - [Faker::JapaneseMedia::FullmetalAlchemistBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
diff --git a/doc/japanese_media/fullmetal_alchemist_brotherhood.md b/doc/japanese_media/fullmetal_alchemist_brotherhood.md index 12c2ffa880..ddd6f1074e 100644 --- a/doc/japanese_media/fullmetal_alchemist_brotherhood.md +++ b/doc/japanese_media/fullmetal_alchemist_brotherhood.md @@ -1,9 +1,9 @@ -# Faker::JapaneseMedia::FmaBrotherhood +# Faker::JapaneseMedia::FullmetalAchemistBrotherhood ```ruby -Faker::JapaneseMedia::FmaBrotherhood.character #=> "Edward Elric" +Faker::JapaneseMedia::FullmetalAchemistBrotherhood.character #=> "Edward Elric" -Faker::JapaneseMedia::FmaBrotherhood.city #=> "Central City" +Faker::JapaneseMedia::FullmetalAchemistBrotherhood.city #=> "Central City" -Faker::JapaneseMedia::FmaBrotherhood.country #=> "Xing" +Faker::JapaneseMedia::FullmetalAchemistBrotherhood.country #=> "Xing" ``` diff --git a/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb b/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb index b07ba37609..493cdf51a0 100644 --- a/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +++ b/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb @@ -2,47 +2,50 @@ module Faker class JapaneseMedia - class FmaBrotherhood < Base + class FullmetalAlchemistBrotherhood < Base class << self ## - # Produces a character from FmaBrotherhood. + # Produces a character from FullmetalAlchemistBrotherhood. # # @return [String] # # @example - # Faker::JapaneseMedia::FmaBrotherhood.character #=> "Edward Elric" + # Faker::JapaneseMedia::FullmetalAlchemistBrotherhood.character #=> "Edward Elric" # # @faker.version next def character - fetch('fma_brotherhood.characters') + fetch('fullmetal_alchemist_brotherhood.characters') end ## - # Produces a cities from FmaBrotherhood. + # Produces a cities from FullmetalAlchemistBrotherhood. # # @return [String] # # @example - # Faker::JapaneseMedia::FmaBrotherhood.city #=> "Central City" + # Faker::JapaneseMedia::FullmetalAlchemistBrotherhood.city #=> "Central City" # # @faker.version next def city - fetch('fma_brotherhood.cities') + fetch('fullmetal_alchemist_brotherhood.cities') end ## - # Produces a country from FmaBrotherhood. + # Produces a country from FullmetalAlchemistBrotherhood. # # @return [String] # # @example - # Faker::JapaneseMedia::FmaBrotherhood.country #=> "Xing" + # Faker::JapaneseMedia::FullmetalAlchemistBrotherhood.country #=> "Xing" # # @faker.version next def country - fetch('fma_brotherhood.countries') + fetch('fullmetal_alchemist_brotherhood.countries') end end end + + include Faker::Deprecator + deprecate_generator('FmaBrotherhood', FullmetalAlchemistBrotherhood) end end diff --git a/lib/locales/en/fma_brotherhood.yml b/lib/locales/en/fullmetal_alchemist_brotherhood.yml similarity index 95% rename from lib/locales/en/fma_brotherhood.yml rename to lib/locales/en/fullmetal_alchemist_brotherhood.yml index d83966071c..6061fe4093 100644 --- a/lib/locales/en/fma_brotherhood.yml +++ b/lib/locales/en/fullmetal_alchemist_brotherhood.yml @@ -1,6 +1,6 @@ en: faker: - fma_brotherhood: + fullmetal_alchemist_brotherhood: characters: - Edward Elric - Alphonse Elric @@ -8,7 +8,7 @@ en: - Riza Hawkeye - Scar - Winry Rockbell - - May Chang + - May Chang - Maes Hughes - Alex Louis Armstrong - Jean Havoc @@ -47,7 +47,7 @@ en: - Isaac McDougal - Solf J. Kimblee - Van Hohenheim - - Fu + - Fu - Ling Yao - Lan Fan - Olivier Mira Armstrong diff --git a/test/faker/japanese_media/test_faker_fullmetal_alchemist_brotherhood.rb b/test/faker/japanese_media/test_faker_fullmetal_alchemist_brotherhood.rb index ad23e96de1..f651796a6a 100644 --- a/test/faker/japanese_media/test_faker_fullmetal_alchemist_brotherhood.rb +++ b/test/faker/japanese_media/test_faker_fullmetal_alchemist_brotherhood.rb @@ -19,3 +19,21 @@ def test_country assert_match(/\w+/, @tester.country) end end + +class TestFakerFullmetalAlchemistBrotherhood < Test::Unit::TestCase + def setup + @tester = Faker::JapaneseMedia::FullmetalAlchemistBrotherhood + end + + def test_character + assert_match(/\w+/, @tester.character) + end + + def test_city + assert_match(/\w+/, @tester.city) + end + + def test_country + assert_match(/\w+/, @tester.country) + end +end