Skip to content

Commit

Permalink
Fix/Deprecate FmaBrotherhood Generator (#2856)
Browse files Browse the repository at this point in the history
* 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:
  - #2787

Co-authored-by: Jamal-A-Mohamed <jamalashur@gmail.com>
Co-authored-by: Salvador <salvador.tena@scientist.com>

* 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:
  - #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 <jamalashur@gmail.com>
Co-authored-by: Salvador <salvador.tena@scientist.com>
Co-authored-by: Stefanni Brasil <stefannibrasil@gmail.com>
  • Loading branch information
4 people committed Feb 26, 2024
1 parent f586da7 commit 7990a43
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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)
</details>

<details>
Expand Down
8 changes: 4 additions & 4 deletions 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"
```
23 changes: 13 additions & 10 deletions lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb
Expand Up @@ -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
@@ -1,14 +1,14 @@
en:
faker:
fma_brotherhood:
fullmetal_alchemist_brotherhood:
characters:
- Edward Elric
- Alphonse Elric
- Roy Mustang
- Riza Hawkeye
- Scar
- Winry Rockbell
- May Chang
- May Chang
- Maes Hughes
- Alex Louis Armstrong
- Jean Havoc
Expand Down Expand Up @@ -47,7 +47,7 @@ en:
- Isaac McDougal
- Solf J. Kimblee
- Van Hohenheim
- Fu
- Fu
- Ling Yao
- Lan Fan
- Olivier Mira Armstrong
Expand Down
Expand Up @@ -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

0 comments on commit 7990a43

Please sign in to comment.