Skip to content

Commit

Permalink
Merge pull request faker-ruby#1758 from connorshea/fix-doctor-who-and…
Browse files Browse the repository at this point in the history
…-add-docs

Add YARD docs for Doctor Who and fix a method name.
  • Loading branch information
vbrazo committed Sep 21, 2019
2 parents 766b964 + 00d0285 commit 89dd36c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 5 deletions.
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

0 comments on commit 89dd36c

Please sign in to comment.