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

Add YARD docs for Doctor Who and fix a method name. #1758

Merged
merged 6 commits into from Sep 21, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/tv_shows/dr_who.md
Expand Up @@ -11,7 +11,7 @@ Faker::TvShows::DrWho.catch_phrase #=> "Fantastic!"

Faker::TvShows::DrWho.quote #=> "Lots of planets have a north!"

Faker::TvShows::DrWho.villian #=> "The Master"
Faker::TvShows::DrWho.villain #=> "The Master"

Faker::TvShows::DrWho.specie #=> "Dalek"
```
80 changes: 78 additions & 2 deletions lib/faker/tv_shows/dr_who.rb
Expand Up @@ -6,30 +6,106 @@ class DrWho < Base
flexible :dr_who

class << self
##
# Produces a character from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.character #=> "Captain Jack Harkness"
#
# @faker.version 1.8.0
def character
fetch('dr_who.character')
end

##
# Produces an iteration of The Doctor from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.the_doctor #=> "Ninth Doctor"
#
# @faker.version 1.8.0
def the_doctor
fetch('dr_who.the_doctors')
end

##
# Produces an actor from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.actor #=> "Matt Smith"
#
# @faker.version 1.9.0
def actor
fetch('dr_who.actors')
end

##
# Produces a catch phrase from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.catch_phrase #=> "Fantastic!"
#
# @faker.version 1.8.0
def catch_phrase
fetch('dr_who.catch_phrases')
end

##
# Produces a quote from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.quote #=> "Lots of planets have a north!"
#
# @faker.version 1.8.0
def quote
fetch('dr_who.quotes')
end

def villian
fetch('dr_who.villians')
##
# Produces a villain from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.villain #=> "The Master"
#
# @faker.version next
def villain
fetch('dr_who.villains')
end

##
# Produces a villain from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.villian #=> "The Master"
#
# @deprecated Use the correctly-spelled `villain` method instead.
#
# @faker.version 1.8.0
alias villian villain

##
# Produces a species from Doctor Who.
#
# @return [String]
#
# @example
# Faker::TvShows::DrWho.specie #=> "Dalek"
#
# @faker.version 1.8.0
def specie
fetch('dr_who.species')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/locales/en/dr_who.yml
Expand Up @@ -41,7 +41,7 @@ en:
"Aw, I wanted to be ginger! I've never been ginger!",
"Crossing into established events is strictly forbidden. Except for cheap tricks.",
]
villians: [
villains: [
"Helen A", "Abzorbaloff", "Animus", "The Master", "Davros", "Dalek Emperor"
]
species: [
Expand Down
8 changes: 7 additions & 1 deletion test/faker/tv_shows/test_dr_who.rb
Expand Up @@ -28,10 +28,15 @@ def test_quote
10.times { assert @tester.quote.match(/[\w]+/) }
end

# deprecated
def test_villian
10.times { assert @tester.villian.match(/[\w]+/) }
end

def test_villain
10.times { assert @tester.villain.match(/[\w]+/) }
end

def test_specie
10.times { assert @tester.specie.match(/[\w]+/) }
end
Expand All @@ -43,7 +48,8 @@ def test_locales
assert @tester.the_doctor .is_a? String
assert @tester.catch_phrase.is_a? String
assert @tester.quote .is_a? String
assert @tester.villian .is_a? String
assert @tester.villian .is_a? String # deprecated
assert @tester.villain .is_a? String
assert @tester.specie .is_a? String
end
end
Expand Down