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

Adds the Faker::Sports::Basketball Generator #1537

Merged
merged 1 commit into from
Feb 14, 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
11 changes: 11 additions & 0 deletions doc/sports/basketball.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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