Skip to content

Commit

Permalink
Add Sports namespace (#1538)
Browse files Browse the repository at this point in the history
* Update unreleased/docs and move sport namespace to unreleased folder

* Deprecate ::Football

* Separate v1.9.3 deprecations from current version deprecaions

* Update Faker::Construction documentation

* Update CHANGELOG

* Update CHANGELOG
  • Loading branch information
vbrazo committed Feb 14, 2019
1 parent 7f75c1b commit acd8a71
Show file tree
Hide file tree
Showing 149 changed files with 212 additions and 113 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
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
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
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
@@ -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
@@ -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.
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.
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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

0 comments on commit acd8a71

Please sign in to comment.