Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added Faker::DC Comics #1319

Merged
merged 6 commits into from
Jul 28, 2018
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Contents
- [Faker::Crypto](doc/crypto.md)
- [Faker::Currency](doc/currency.md)
- [Faker::Date](doc/date.md)
- [Faker::DcComics](doc/dc_comics.md)
- [Faker::Demographic](doc/demographic.md)
- [Faker::Dessert](doc/dessert.md)
- [Faker::Device](doc/device.md)
Expand Down
15 changes: 15 additions & 0 deletions doc/dc_comics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Faker::DcComics

It might be available in the next version.

A fun collection of hundreds of your favorite DC Comics Heroes, Heroines, Villains, Alter Egos and Side Characters. Have fun!

```ruby
Faker::DcComics.hero #=> "Batman"

Faker::DcComics.heroine #=> "Supergirl"

Faker::DcComics.villain #=> "The Joker"

Faker::DcComics.name #=> "Clark Kent"
```
21 changes: 21 additions & 0 deletions lib/faker/dc_comics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Faker
class DcComics < Base
def self.hero
fetch('dc_comics.hero')
end

def self.heroine
fetch('dc_comics.heroine')
end

def self.villain
fetch('dc_comics.villain')
end

def self.name
fetch('dc_comics.name')
end
end
end
39 changes: 39 additions & 0 deletions lib/locales/en/dc_comics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
en:
faker:
dc_comics:
hero: [
"Batman", "Superman", "Red Arrow", "Green Lantern", "Robin",
"Nightwing", "The Flash", "Aquaman", "Green Arrow", "Captain Marvel",
"Shazam", "Martain Manhunter", "Cyborg", "Hawkman", "Speedy", "Arsenal",
"Red Tornado","Booster Gold", "Doctor Fate", "Beast Boy", "Plastic Man",
"Captain Atom", "Tempest", "Spectre", "Midnighter", "The Atom", "Kilowog",
"Firestorm", "Blue Beetle", "Animal Man", "Mr. Miracle", "Wildcat",
"Rorschach", "Dr. Manhattan", "Nite Owl", "The Comedian", "Azrael",
"Jonah Hex", "Apollo", "Black Lightning", "Orion", "Steel", "Superboy",
"Doctor Mid-Nite", "Mr. Terrific", "Ragman", "Captain Comet", "The Sandman",
"Dr. Fate", "Guardian"
]
heroine: [
"Wonder Woman", "Hawkgirl", "Supergirl", "Black Canary", "Batgirl",
"Raven", "Wonder Girl", "Starfire", "Lady Cain", "Power Girl", "Mera",
"Vixen", "Silk Spectre", "Batwoman", "Mary Marvel"
]
villain: [
"The Joker", "Lex Luthor", "Darkseid", "Sinestro", "Brainiac", "Black Adam",
"Ras al Ghul", "Deathstroke", "Two-Face", "Doomsday", "Catwoman", "Mongul",
"Bizaroo", "Riddler", "Captain Cold", "Bane", "Harley Quinn", "Scarecrow",
"Paralax", "Gorilla Grodd", "General Zod", "Black Manta", "Mr. Freeze",
"Cheetah", "Amanda Waller", "Penguin", "Poison Ivy", "Solomon Grundy",
"Parasite", "Krona", "Deadshot", "Metallo", "Lobo", "Eclipso", "Ares",
"Hugo Strange", "Despero", "Talia al Ghul", "Mirror Master", "Captain Boomerang",
"Mr. Mxyzptlk", "Weather Wizard", "Heat Wave", "Clock King", "Clay Face",
"Killer Croc", "Gentleman Ghost", "Toy Man", "Starro"
]
name: [
"John Stewart", "Hal Jordan", "Kyle Rayner", "Barry Allen", "James Gordon",
"Dianna Prince", "Lois Lane", "Barbara Gordon", "Jason Todd", "Bart Allen",
"John Constantine", "Roy Harper", "Clark Kent", "Bruce Wayne", "Dick Grayson",
"Billy Batson", "Michael Jon Carter", "Tim Drake", "Jay Garrick", "Damian Wayne",
"Ray Palmer", "Ted Kord", "Connor Hawke", "Terry McGinnis", "Harvey Bullock",
"Al Pratt", "Wesley Dodds", "Maxwell Lord", "Oswald Cobblepot", "Alfred Pennyworth"
]
25 changes: 25 additions & 0 deletions test/test_faker_dc_comics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require_relative 'test_helper'

class TestFakerDcComics < Test::Unit::TestCase
def setup
@tester = Faker::DcComics
end

def test_hero
assert @tester.hero.match(/\w+/)
end

def test_heroine
assert @tester.heroine.match(/\w+/)
end

def test_villain
assert @tester.villain.match(/\w+/)
end

def test_name
assert @tester.name.match(/\w+/)
end
end