-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding Faker::Football * Adding tests * Adding football specific documentation and including link to it on README.md * Fixing name of football coaches locale * Fixing typo in tests - Changing 'asssert' for 'assert' * Adding football data * Fixing Tottenham Hotspur name
- Loading branch information
1 parent
eb76237
commit 06c935b
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Faker::Football | ||
|
||
```ruby | ||
Faker::Football.team #=> "Manchester United" | ||
|
||
Faker::Football.player #=> "Lionel Messi" | ||
|
||
Faker::Football.coach #=> "Jose Mourinho" | ||
|
||
Faker::Football.competition #=> "FIFA World Cup" | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Faker | ||
class Football < Base | ||
class << self | ||
def team | ||
fetch('football.teams') | ||
end | ||
|
||
def player | ||
fetch('football.players') | ||
end | ||
|
||
def coach | ||
fetch('football.coaches') | ||
end | ||
|
||
def competition | ||
fetch('football.competitions') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
en: | ||
faker: | ||
football: | ||
teams: ["Real Madrid", "FC Barcelona", "Valencia CF", "Atletico Madrid", "Manchester United", "Chelsea", "Liverpool", "Arsenal", "Tottenham Hotspur", "AC Milan", "Inter Milan", "AS Roma", "Juventus", "Bayern Munich", "Borussia Dortmund", "Schalke 04", "Benfica", "Galatasaray", "PSV Eindhoven", "LA Galaxy"] | ||
players: ["Lionel Messi", "Gerard Pique", "Sergio Ramos", "Cristiano Ronaldo", "David De Gea", "Paul Pogba", "Antoine Griezmann", "Alvaro Morata", "Andres Iniesta", "Roberto Firmino", "Mohammed Salah", "Harry Kane", "Delle Alli", "Arjen Robben", "Franck Ribery", "Marco Reus", "Robert Lewandoski", "Zlatan Ibrahimovic", "Edinson Cavani", "Sergio Aguero", "Neymar", "Mesut Ozil", "Gianluigi Buffon", "Willian", "Manuel Neuer", "Juan Mata", "Manuel Neuer", "Cesc Fabregas", "Gareth Bale", "Eden Hazard", "Mario Mandzukic"] | ||
coaches: ["Ernesto Valverde", "Zinedine Zidane", "Jose Mourinho", "Antonio Conte", "Jurgen Klopp", "Mauricio Pochettino", "Diego Simeone", "Massimiliano Allegri", "Jupp Heyneckes", "Arsene Wenger", "Jorge Sampaoli", "Fernando Santos", "Didier Deschamps", "Joachim Low", "Julen Lopetegui", "Mauricio Pochettino", "Unai Emery", "Massimiliano Allegri", "UEFA European Championship", "Asian Cup", "African Cup of Nations", "Copa America" ] | ||
competitions: ["UEFA Champions League", "FIFA World Cup", "UEFA Europa League", "Serie A", "Barclays Premier League", "Bundesliga", "Liga Santander", "FA Cup", "Ligue 1", "Primeira Liga", "Eredivisie", "Super League", "Major League Soccer", "Coppa Italia", "DFB Pokal", "CONCACAF Gold Cup", "Nations Cup", "Copa del Rey"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') | ||
|
||
class TestFakerFootball < Test::Unit::TestCase | ||
def setup | ||
@tester = Faker::Football | ||
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_competition | ||
assert @tester.competition.match(/\w+/) | ||
end | ||
end |