Skip to content

Commit

Permalink
Rename Faker::show to Faker::Theater (#2921)
Browse files Browse the repository at this point in the history
* Renamed Faker::Show to Faker::Theater

* Updated Readme

* Updated test to explcitly use Faker::Theater
  • Loading branch information
keshavbiswa authored Apr 2, 2024
1 parent e15e606 commit dd8c88c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
- [Faker::Superhero](doc/default/superhero.md)
- [Faker::Tea](doc/default/tea.md)
- [Faker::Team](doc/default/team.md)
- [Faker::Theater](doc/default/theater.md)
- [Faker::Time](doc/default/time.md)
- [Faker::Twitter](doc/default/twitter.md)
- [Faker::Types](doc/default/types.md)
Expand Down
12 changes: 12 additions & 0 deletions doc/default/theater.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Faker::Theater

```ruby
# Produces the name of a musical for an older audience
Faker::Theater.adult_musical #=> "Mamma Mia!"

# Produces the name of a musical for a younger audience
Faker::Theater.kids_musical #=> "Into the Woods JR."

# Produces the name of a play
Faker::Theater.play #=> "The Death of a Salesman"

7 changes: 0 additions & 7 deletions doc/unreleased/music/show.md

This file was deleted.

19 changes: 11 additions & 8 deletions lib/faker/music/show.rb → lib/faker/default/theater.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# frozen_string_literal: true

module Faker
class Show < Base
class Theater < Base
class << self
##
# Produces the name of a musical for an older audience
#
# @return [String]
#
# @example
# Faker::Alphanumeric.alpha
# #=> "West Side Story"
# Faker::Theater.adult_musical
# #=> "Mamma Mia!"
#
# @faker.version 2.13.0
def adult_musical
fetch('show.adult_musical')
fetch('theater.adult_musical')
end

##
Expand All @@ -23,12 +23,12 @@ def adult_musical
# @return [String]
#
# @example
# Faker::Alphanumeric.alpha
# Faker::Theater.kids_musical
# #=> "Into the Woods JR."
#
# @faker.version 2.13.0
def kids_musical
fetch('show.kids_musical')
fetch('theater.kids_musical')
end

##
Expand All @@ -37,13 +37,16 @@ def kids_musical
# @return [String]
#
# @example
# Faker::Alphanumeric.alpha
# Faker::Theater.play
# #=> "Death of a Salesman"
#
# @faker.version 2.13.0
def play
fetch('show.play')
fetch('theater.play')
end
end
end

include Faker::Deprecator
deprecate_generator('Show', Theater)
end
2 changes: 1 addition & 1 deletion lib/locales/en/show.yml → lib/locales/en/theater.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
en:
faker:
show:
theater:
adult_musical:
- "Elton John and Tim Rice's Aida"
- "Ain't Misbehavin'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

require_relative '../../test_helper'

class TestFakerTheater < Test::Unit::TestCase
def test_adult_musical
assert_match(/\w+/, Faker::Theater.adult_musical)
end

def test_kids_musical
assert_match(/\w+/, Faker::Theater.kids_musical)
end

def test_play
assert_match(/\w+/, Faker::Theater.play)
end
end

# with test_faker_show.rb
class TestFakerShow < Test::Unit::TestCase
def test_adult_musical
assert_match(/\w+/, Faker::Show.adult_musical)
Expand Down

0 comments on commit dd8c88c

Please sign in to comment.