Skip to content

Commit

Permalink
Adds the Faker::Sports::Basketball generator (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecbrodie authored and vbrazo committed Feb 14, 2019
1 parent 07290fe commit 7f75c1b
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 1 deletion.
11 changes: 11 additions & 0 deletions doc/sports/basketball.md
@@ -0,0 +1,11 @@
# Faker::Sports::Basketball

```ruby
Faker::Sports::Basketball.team #=> "Golden State Warriors"

Faker::Sports::Basketball.player #=> "LeBron James"

Faker::Sports::Basketball.coach #=> "Gregg Popovich"

Faker::Sports::Basketball.position #=> "Point Guard"
```
25 changes: 25 additions & 0 deletions lib/faker/sports/basketball.rb
@@ -0,0 +1,25 @@
# frozen_string_literal: true

module Faker
module Sports
class Basketball < Base
class << self
def team
fetch('basketball.teams')
end

def player
fetch('basketball.players')
end

def coach
fetch('basketball.coaches')
end

def position
fetch('basketball.positions')
end
end
end
end
end
99 changes: 99 additions & 0 deletions lib/locales/en/basketball.yml
@@ -0,0 +1,99 @@
en:
faker:
basketball:
teams:
- Atlanta Hawks
- Boston Celtics
- Brooklyn Nets
- Charlotte Hornets
- Chicago Bulls
- Cleveland Cavaliers
- Dallas Mavericks
- Denver Nuggets
- Detroit Pistons
- Golden State Warriors
- Houston Rockets
- Indiana Pacers
- Los Angeles Clippers
- Los Angeles Lakers
- Memphis Grizzlies
- Miami Heat
- Milwaukee Bucks
- Minnesota Timberwolves
- New Orleans Pelicans
- New York Knicks
- Oklahoma City Thunder
- Orlando Magic
- Philadelphia 76ers
- Phoenix Suns
- Portland Trail Blazers
- Sacramento Kings
- San Antonio Spurs
- Toronto Raptors
- Utah Jazz
- Washington Wizards
players:
- Kemba Walker
- Kyrie Irving
- Kawhi Leonard
- Giannis Antetokounmpo
- Joel Embiid
- Kyle Lowry
- Victor Oladipo
- Khris Middleton
- Bradley Beal
- Ben Simmons
- Blake Griffin
- Nikola Vučević
- Dwayne Wade
- D'Angelo Russell
- Stephen Curry
- James Harden
- Kevin Durant
- Paul George
- LeBron James
- Russell Westbrook
- Damian Lillard
- Klay Thompson
- Anthony Davis
- LaMarcus Aldridge
- Nikola Jokić
- Karl-Anthony Towns
- Dirk Nowitzki
coaches:
- Kenny Atkinson
- J.B. Bickerstaff
- James Borrego
- Jim Boylen
- Scott Brooks
- Brett Brown
- Mike Budenholzer
- Rick Carlisle
- Dwane Casey
- Steve Clifford
- Mike D'Antoni
- Billy Donovan
- Larry Drew
- David Fizdale
- Alvin Gentry
- Dave Joerger
- Steve Kerr
- Igor Kokoškov
- Michael Malone
- Nate McMillan
- Nick Nurse
- Lloyd Pierce
- Gregg Popovich
- Doc Rivers
- Ryan Saunders
- Quin Snyder
- Erik Spoelstra
- Brad Stevens
- Terry Stotts
- Luke Walton
positions:
- Point Guard
- Shooting Guard
- Small Forward
- Power Forward
- Center
25 changes: 25 additions & 0 deletions test/faker/sports/test_faker_basketball.rb
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require_relative '../../test_helper'

class TestFakerBasketball < Test::Unit::TestCase
def setup
@tester = Faker::Sports::Basketball
end

def test_team
assert @tester.team.match(/\w+/)
end

def test_player
assert @tester.player.match(/\w+/)
end

def test_coach
assert @tester.coach.match(/\w+/)
end

def test_position
assert @tester.position.match(/\w+/)
end
end
2 changes: 1 addition & 1 deletion test/test_determinism.rb
Expand Up @@ -45,7 +45,7 @@ def all_methods

def subclasses
Faker.constants.delete_if do |subclass|
%i[Base Bank Books Cat Char Base58 ChileRut Config Creature Date Dog DragonBall Dota ElderScrolls Fallout Games GamesHalfLife HeroesOfTheStorm Internet JapaneseMedia LeagueOfLegends Movies Myst Overwatch OnePiece Pokemon SwordArtOnline TvShows Time VERSION Witcher WorldOfWarcraft Zelda].include?(subclass)
%i[Base Bank Books Cat Char Base58 ChileRut Config Creature Date Dog DragonBall Dota ElderScrolls Fallout Games GamesHalfLife HeroesOfTheStorm Internet JapaneseMedia LeagueOfLegends Movies Myst Overwatch OnePiece Pokemon Sports SwordArtOnline TvShows Time VERSION Witcher WorldOfWarcraft Zelda].include?(subclass)
end.sort
end

Expand Down

0 comments on commit 7f75c1b

Please sign in to comment.