Skip to content

Commit

Permalink
Add Clash Of Clans to the Game category (#2143)
Browse files Browse the repository at this point in the history
* Add Conan to the JapaneseMedia category

* Updated README

* Fix the clash_of_clan yaml file

* Changed the english mistake in clash_of_clans.md file

* Removed the line
  • Loading branch information
jamesmai0512 authored Oct 10, 2020
1 parent 396e01a commit 1447abf
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
- [Faker::Games::Witcher](doc/games/witcher.md)
- [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
- [Faker::Games::Zelda](doc/games/zelda.md)
- [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)

### Japanese Media
- [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
Expand Down
9 changes: 9 additions & 0 deletions doc/games/clash_of_clans.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Faker::Games::ClashOfClans

```ruby
Faker::Games::ClashOfClans.troop #=> "Barbarian"

Faker::Games::ClashOfClans.rank #=> "Legend"

Faker::Games::ClashOfClans.defensive_building #=> "Cannon"
```
48 changes: 48 additions & 0 deletions lib/faker/games/clash_of_clans.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

module Faker
class Games
class ClashOfClans < Base
class << self
##
# Produces the name of a troop from Clash of Clans.
#
# @return [String]
#
# @example
# Faker::Games::ClashOfClans.troop #=> "Barbarian"
#
# @faker.version next
def troop
fetch('games.clash_of_clans.troops')
end

##
# Produces the name of a rank from Clash Of Clans.
#
# @return [String]
#
# @example
# Faker::Games::ClashOfClans.rank #=> "Legend"
#
# @faker.version next
def rank
fetch('games.clash_of_clans.ranks')
end

##
# Produces the name of a defensive buiding from Clash Of Clans.
#
# @return [String]
#
# @example
# Faker::Games::ClashOfClans.defensive_building #=> "Cannon"
#
# @faker.version next
def defensive_building
fetch('games.clash_of_clans.defensive_buildings')
end
end
end
end
end
101 changes: 101 additions & 0 deletions lib/locales/en/clash_of_clan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
en:
faker:
games:
clash_of_clans:
troops:
- Barbarian
- Archer
- Giant
- Goblin
- Wall Breaker
- Balloon
- Wizard
- Healer
- Dragon
- P.E.K.K.A
- Baby Dragon
- Miner
- Electro Dragon
- Yeti (Yetimite)
- Ice Wizard
- Battle Ram (Barbarian)
- Pumpkin Barbarian (Barbarian)
- Giant Skeleton
- Skeleton Barrel (Skeleton)
- El Primo
- Party Wizard
- Royal Ghost
- Minion
- Hog Rider
- Valkyrie
- Golem (Golemite)
- Witch (Skeleton)
- Lava Hound (Lava Pup)
- Bowler
- Ice Golem
- Headhunter
- Raged Barbarian
- Sneaky Archer
- Boxer Giant
- Beta Minion
- Bomber
- Baby Dragon
- Cannon Cart
- Night Witch (Bat)
- Drop Ship (Skeleton)
- Super P.E.K.K.A
- Hog Glider (Hog Rider)

ranks:
- Unranked
- Bronze III
- Bronze II
- Bronze I
- Silver III
- Silver II
- Silver I
- Gold III
- Gold II
- Gold I
- Crystal III
- Crystal II
- Crystal I
- Master III
- Master II
- Master I
- Champion III
- Champion II
- Champion I
- Titan III
- Titan II
- Titan I
- Legend

defensive_buildings:
- Cannon
- Archer Tower
- Mortar
- Air Defense
- Wizard Tower
- Air Sweeper
- Hidden Tesla
- Bomb Tower
- X-Bow
- Inferno Tower
- Eagle Artillery
- Giga Tesla
- Giga Inferno
- Scattershot
- Walls
- Traps
- Double Cannon
- Firecrackers
- Crusher
- Guard Post
- Air Bombs
- Multi Mortar
- Roaster
- Giant Cannon
- Mega Tesla
- Lava Launcher
- Traps
21 changes: 21 additions & 0 deletions test/faker/games/test_faker_clash_of_clans.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require_relative '../../test_helper'

class TestFakerClashOfClans < Test::Unit::TestCase
def setup
@tester = Faker::Games::ClashOfClans
end

def test_troop
assert @tester.troop.match(/\w+/)
end

def test_rank
assert @tester.rank.match(/\w+/)
end

def test_defensive_building
assert @tester.defensive_building.match(/\w+/)
end
end

0 comments on commit 1447abf

Please sign in to comment.