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

Add Sports namespace #1538

Merged
merged 6 commits 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

### Deprecation

- [PR #1538](https://github.com/stympy/faker/pull/1538) Add Sports namespace [@vbrazo](https://github.com/vbrazo)
- Deprecates `::Football`

### Documentation

### Feature Request

- [PR #1537](https://github.com/stympy/faker/pull/1537) Adds the Faker::Sports::Basketball generator [@ecbrodie](https://github.com/ecbrodie)

### Suggestion

### Update/add locales
Expand Down
12 changes: 12 additions & 0 deletions doc/default/construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,16 @@ Faker::Construction.material #=> "Wood"

# Random subcontract category
Faker::Construction.subcontract_category #=> "Curb & Gutter"

# Random heavy_equipment
Faker::Construction.heavy_equipment #=> "Excavator"

# Random trade
Faker::Construction.trade #=> "Carpenter"

# Random standard_cost_code
Faker::Construction.standard_cost_code #=> "1-000 - Purpose"

# Random role
Faker::Construction.role #=> "Engineer"
```
12 changes: 12 additions & 0 deletions doc/unreleased/default/construction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,16 @@ Faker::Construction.material #=> "Wood"

# Random subcontract category
Faker::Construction.subcontract_category #=> "Curb & Gutter"

# Random heavy_equipment
Faker::Construction.heavy_equipment #=> "Excavator"

# Random trade
Faker::Construction.trade #=> "Carpenter"

# Random standard_cost_code
Faker::Construction.standard_cost_code #=> "1-000 - Purpose"

# Random role
Faker::Construction.role #=> "Engineer"
```
16 changes: 0 additions & 16 deletions doc/unreleased/default/football.md

This file was deleted.

File renamed without changes.
15 changes: 15 additions & 0 deletions doc/unreleased/sports/football.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Faker::Sports::Football

Available since version 1.9.0.

```ruby
Faker::Sports::Football.team #=> "Manchester United"

Faker::Sports::Football.player #=> "Lionel Messi"

Faker::Sports::Football.coach #=> "Jose Mourinho"

Faker::Sports::Football.competition #=> "FIFA World Cup"

Faker::Sports::Football.position #=> "Defensive Midfielder"
```
27 changes: 0 additions & 27 deletions lib/faker/default/football.rb

This file was deleted.

35 changes: 35 additions & 0 deletions lib/faker/deprecate/unreleased/football.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

module Faker
class Football
class << self
extend Gem::Deprecate

def team
Faker::Sports::Football.team
end

def player
Faker::Sports::Football.player
end

def coach
Faker::Sports::Football.coach
end

def competition
Faker::Sports::Football.competition
end

def position
Faker::Sports::Football.position
end

deprecate :team, 'Faker::Sports::Football.team', 2019, 04
deprecate :player, 'Faker::Sports::Football.player', 2019, 04
deprecate :coach, 'Faker::Sports::Football.coach', 2019, 04
deprecate :competition, 'Faker::Sports::Football.competition', 2019, 04
deprecate :position, 'Faker::Sports::Football.position', 2019, 04
end
end
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/faker/sports/basketball.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Faker
module Sports
class Sports
class Basketball < Base
class << self
def team
Expand Down
29 changes: 29 additions & 0 deletions lib/faker/sports/football.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module Faker
class Sports
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

def position
fetch('football.positions')
end
end
end
end
end
29 changes: 29 additions & 0 deletions test/deprecate/unreleased/test_deprecate_football.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

require_relative '../../test_helper'

class TestDeprecateFootball < 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

def test_position
assert @tester.position.match(/\w+/)
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateAquaTeenHungerForce < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateBackToTheFuture < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateBitcoin < Test::Unit::TestCase
def test_address
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateBojackHorseman < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateBreakingBad < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateBuffy < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateCat < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateCommunity < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateDog < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateDota < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateDrWho < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestFakerDragonBall < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateDumbAndDumber < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateDune < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateElderScrolls < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateEthereum < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateFallout < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateFamilyGuy < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateFriends < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateGameOfThrones < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateHarryPotter < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateHeroesOfTheStorm < Test::Unit::TestCase
def setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../test_helper'

class TestDeprecateHeyArnold < Test::Unit::TestCase
def setup
Expand Down
Loading