Skip to content

Commit

Permalink
Add Faker::Nation.national_sport (#1268)
Browse files Browse the repository at this point in the history
* Added test to check for national sport generator

* Added national sports locals and codebase to fetch hem

* Updated documentation

* Used previously exisiting locals for sport and added more sport to the sport

* Update changelog.md
  • Loading branch information
gkunwar authored and vbrazo committed Jun 5, 2018
1 parent 891d6ea commit d369179
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Change Log

## HEAD Unreleased
### Latest update: 2018-06-02
### Latest update: 2018-06-05

### Feature Request
- [PR #1268](https://github.com/stympy/faker/pull/1268) Add Faker::Nation.national_sport [@gkunwar](https://github.com/gkunwar)
- [PR #1273](https://github.com/stympy/faker/pull/1273) Add Faker::Device [@vbrazo](https://github.com/vbrazo)
- [PR #1272](https://github.com/stympy/faker/pull/1272) Add Faker::DrWho.actor [@timcustard](https://github.com/timcustard)
- [PR #1270](https://github.com/stympy/faker/pull/1270) Add Faker::Name.middle_name [@vbrazo](https://github.com/vbrazo)
Expand Down Expand Up @@ -49,6 +50,7 @@
- [PR #900](https://github.com/stympy/faker/pull/900) Add Japanese lorem words to locale [@vietqhoang](https://github.com/vietqhoang)

### Update/add locales
- [PR #1275](https://github.com/stympy/faker/pull/1275) Fix typo; RedWine should be two words [@johnmuhl](https://github.com/johnmuhl)
- [PR #1269](https://github.com/stympy/faker/pull/1269) Update Faker::ProgrammingLanguage.name locales [@vbrazo](https://github.com/vbrazo)
- [PR #1140](https://github.com/stympy/faker/pull/1140) Add Estonian and Latvian locales [@maciej-szlosarczyk](https://github.com/maciej-szlosarczyk)
- [PR #1249](https://github.com/stympy/faker/pull/1249) Update list of name prefixes for sv locale. [kamilbielawski](https://github.com/kamilbielawski)
Expand Down
3 changes: 3 additions & 0 deletions doc/nation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ Faker::Nation.language #=> "Nepali"

# Random Capital City
Faker::Nation.capital_city #=> "Kathmandu"

# Random Natinal Sport
Faker::Nation.national_sport #=> "dandi biyo"
5 changes: 5 additions & 0 deletions lib/faker/nation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def language
def capital_city
fetch('nation.capital_city')
end

# Fetch random natinal sport
def national_sport
fetch('team.sport')
end
end
end
end
2 changes: 1 addition & 1 deletion lib/locales/en/team.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ en:
creature: ['ants', 'bats', 'bears', 'bees', 'birds', 'buffalo', 'cats', 'chickens', 'cattle', 'dogs', 'dolphins', 'ducks', 'elephants', 'fishes', 'foxes', 'frogs', 'geese', 'goats', 'horses', 'kangaroos', 'lions', 'monkeys', 'owls', 'oxen', 'penguins', 'people', 'pigs', 'rabbits', 'sheep', 'tigers', 'whales', 'wolves', 'zebras', 'banshees', 'crows', 'black cats', 'chimeras', 'ghosts', 'conspirators', 'dragons', 'dwarves', 'elves', 'enchanters', 'exorcists', 'sons', 'foes', 'giants', 'gnomes', 'goblins', 'gooses', 'griffins', 'lycanthropes', 'nemesis', 'ogres', 'oracles', 'prophets', 'sorcerors', 'spiders', 'spirits', 'vampires', 'warlocks', 'vixens', 'werewolves', 'witches', 'worshipers', 'zombies', 'druids']
name:
- "#{Address.state} #{creature}"
sport: ['baseball', 'basketball', 'football', 'hockey', 'rugby', 'lacrosse', 'soccer']
sport: ['baseball', 'basketball', 'football', 'hockey', 'rugby', 'lacrosse', 'soccer', 'buzkashi', 'cricket', 'kabaddi', 'archery', 'field hockey', 'wrestling', 'association', 'sumo', 'dandi biyo', 'league', 'arnis', 'bandy', 'taekwondo', 'volley ball', 'oil wrestling', 'handball', 'pesäpallo', 'rugby union', 'golf', 'bull fighting', 'shooting', 'gymnastics', 'water polo']
mascot: ['Raymond', 'Bailey', 'Rocky', 'Screech', 'Steely McBeam', 'Nordy', 'Hugo', 'Griz', 'Iceburgh', 'Mr. Redlegs', 'Benny the Bull', 'Big Red', 'Suns Gorilla', 'Pirate Parrot', 'Ragar the Viking', 'JazzBear', 'Wally the Green Monster', 'Burnie', 'K.C. Wolf', 'Sausages', 'Mr. Met', 'Youppi', 'The Raptor', 'Jaxson De Ville', 'Phanatic']
4 changes: 4 additions & 0 deletions test/test_faker_nation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ def test_language
def test_capital_city
assert @tester.capital_city.match(/(\w+\.? ?){2,3}/)
end

def test_natinonal_sport
assert @tester.national_sport.match(/(\w+\.? ?){2,3}/)
end
end

0 comments on commit d369179

Please sign in to comment.