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

Rename Faker::show to Faker::Theater #2921

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
keshavbiswa marked this conversation as resolved.
Show resolved Hide resolved
- [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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

# #=> "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
Loading