Skip to content

Commit

Permalink
Add Game of Thrones
Browse files Browse the repository at this point in the history
  • Loading branch information
duduribeiro authored and stympy committed Jul 13, 2016
1 parent 70ff61d commit 5843988
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Contents
- [Faker::Space](#fakerspace)
- [Faker::Music](#fakermusic)
- [Faker::Vehicle](#fakervehicle)
- [Faker::GameOfThrones](#fakergameofthrones)
- [Customization](#customization)
- [Contributing](#contributing)
- [Contact](#contact)
Expand Down Expand Up @@ -840,6 +841,17 @@ Faker::Vehicle.vin #=> "LLDWXZLG77VK2LUUF"
Faker::Vehicle.manufacture #=> "JAGUAR CARS LTD"
```

###Faker::GameOfThrones
----------------

```ruby
Faker::GameOfThrones.character #=> "Tyrion Lannister"
Faker::GameOfThrones.house #=> "Stark"
Faker::GameOfThrones.city #=> "Lannisport"
```

Customization
------------
Since you may want to make addresses and other types of data look different
Expand Down
1 change: 1 addition & 0 deletions lib/faker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def rand_in_range(from, to)
require 'faker/yoda'
require 'faker/music'
require 'faker/vehicle'
require 'faker/game_of_thrones'

require 'extensions/array'
require 'extensions/symbol'
Expand Down
17 changes: 17 additions & 0 deletions lib/faker/game_of_thrones.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Faker
class GameOfThrones < Base
class << self
def character
fetch('game_of_thrones.characters')
end

def house
fetch('game_of_thrones.houses')
end

def city
fetch('game_of_thrones.cities')
end
end
end
end
5 changes: 5 additions & 0 deletions lib/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,8 @@ en:
file:
extension: ["flac", "mp3", "wav", "bmp", "gif", "jpeg", "jpg", "png", "tiff", "css", "csv", "html", "js", "json", "txt", "mp4", "avi", "mov", "webm", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "odt", "ods", "odp", "pages", "numbers", "key", "pdf"]
mime_type: ["application/atom+xml", "application/ecmascript", "application/EDI-X12", "application/EDIFACT", "application/json", "application/javascript", "application/ogg", "application/pdf", "application/postscript", "application/rdf+xml", "application/rss+xml", "application/soap+xml", "application/font-woff", "application/xhtml+xml", "application/xml-dtd", "application/xop+xml", "application/zip", "application/gzip", "audio/basic", "audio/L24", "audio/mp4", "audio/mpeg", "audio/ogg", "audio/vorbis", "audio/vnd.rn-realaudio", "audio/vnd.wave", "audio/webm", "image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/svg+xml", "image/tiff", "image/vnd.microsoft.icon", "message/http", "message/imdn+xml", "message/partial", "message/rfc822", "model/example", "model/iges", "model/mesh", "model/vrml", "model/x3d+binary", "model/x3d+vrml", "model/x3d+xml", "multipart/mixed", "multipart/alternative", "multipart/related", "multipart/form-data", "multipart/signed", "multipart/encrypted", "text/cmd", "text/css", "text/csv", "text/html", "text/javascript", "text/plain", "text/vcard", "text/xml", "video/mpeg", "video/mp4", "video/ogg", "video/quicktime", "video/webm", "video/x-matroska", "video/x-ms-wmv", "video/x-flv"]

game_of_thrones:
characters: ['Daenerys Targaryen', 'Jon Snow', 'Arya Stark', 'Gregor Clegane', 'Melisandre', 'Tyrion Lannister', 'Jaime Lannister', 'Cersei Lannister', 'Petyr Baelish', 'Jorah Mormont', 'Sansa Stark', 'Theon Greyjoy', 'Bran Stark', 'Sandor Clegane', 'Joffrey Baratheon', 'Catelyn Stark', 'Robb Stark', 'Ned Stark', 'Robert Baratheon', 'Viserys Targaryen', 'Varys', 'Samwell Tarly', 'Bronn', 'Tywin Lannister', 'Jeor Mormont', 'Shae', 'Gendry', 'Tommen Baratheon', "Jaqen H'ghar", 'Khal Drogo', 'Davos Seaworth', 'Margaery Tyrell', 'Stannis Baratheon', 'Ygritte', 'Brienne of Tarth', 'Roose Bolton', 'Ramsay Bolton']
houses: ['Arryn', 'Baratheon', 'Bolton', 'Frey', 'Greyjoy', 'Lannister', 'Martell', 'Stark', 'Targaryen', 'Tully', 'Tyrell']
cities: ['Braavos', "King's Landing", 'Volantis', 'Qarth', 'Asshai', 'Old Valyria', 'Meereen', 'Oldtown', 'Pentos', 'Astapor', 'Yunkai', 'Lorath', 'Lys', 'Vaes Dothrak', 'Sunspear', 'White Harbor', 'Myr', 'Lannisport', 'Qohor', 'Tyrosh', 'Norvos', 'Gulltown', 'Old Ghis', 'New Ghis', 'Mantarys', 'Bayasabhad', 'Elyria', 'Tolos', 'Samyrian', 'Chroyane', 'Tyria', 'Oros', 'Bhorash', 'Ny Sar', 'Sar Meel', 'Ar Noy']
19 changes: 19 additions & 0 deletions test/test_faker_game_of_thrones.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')

class TestFakerGameOfThrones < Test::Unit::TestCase
def setup
@tester = Faker::GameOfThrones
end

def test_character
assert @tester.character.match(/\w+/)
end

def test_house
assert @tester.house.match(/\w+/)
end

def test_city
assert @tester.city.match(/\w+/)
end
end

0 comments on commit 5843988

Please sign in to comment.