From 85689456a0a89d0005a7d005461d9a62c07530dc Mon Sep 17 00:00:00 2001 From: James P Hartman <31163160+JauntyJames@users.noreply.github.com> Date: Thu, 12 Jul 2018 00:04:39 -0400 Subject: [PATCH] Add Faker::Cosmere (#1115) --- README.md | 1 + doc/cosmere.md | 23 +++++++++++++++ lib/faker/cosmere.rb | 46 ++++++++++++++++++++++++++++++ lib/locales/en/cosmere.yml | 57 ++++++++++++++++++++++++++++++++++++++ test/test_faker_cosmere.rb | 43 ++++++++++++++++++++++++++++ 5 files changed, 170 insertions(+) create mode 100644 doc/cosmere.md create mode 100644 lib/faker/cosmere.rb create mode 100644 lib/locales/en/cosmere.yml create mode 100644 test/test_faker_cosmere.rb diff --git a/README.md b/README.md index ae2cc5f4e4..e2660a6813 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Contents - [Faker::Community](doc/community.md) - [Faker::Company](doc/company.md) - [Faker::Compass](doc/compass.md) + - [Faker::Cosmere](doc/cosmere.md) - [Faker::Crypto](doc/crypto.md) - [Faker::Currency](doc/currency.md) - [Faker::Date](doc/date.md) diff --git a/doc/cosmere.md b/doc/cosmere.md new file mode 100644 index 0000000000..ed34ba2c88 --- /dev/null +++ b/doc/cosmere.md @@ -0,0 +1,23 @@ +# Faker::Cosmere + +```ruby +Faker::Cosmere.aon #=> "Rao" + +Faker::Cosmere.shard_world #=> "Yolen" + +Faker::Cosmere.shard #=> "Ambition" + +Faker::Cosmere.surge #=> "Progression" + +Faker::Cosmere.knight_radiant #=> "Truthwatcher" + +Faker::Cosmere.metal #=> "Brass" + +Faker::Cosmere.allomancer #=> "Coinshot" + +Faker::Cosmere.feruchemist #=> "Archivist" + +Faker::Cosmere.herald #=> "Ishar" + +Faker::Cosmere.spren #=> "Flamespren" +``` diff --git a/lib/faker/cosmere.rb b/lib/faker/cosmere.rb new file mode 100644 index 0000000000..e0d6b6ea4d --- /dev/null +++ b/lib/faker/cosmere.rb @@ -0,0 +1,46 @@ +module Faker + class Cosmere < Base + flexible :cosmere + class << self + def aon + sample(aons) + end + + def shard_world + sample(shard_worlds) + end + + def shard + sample(shards) + end + + def surge + sample(surges) + end + + def knight_radiant + sample(knights_radiant) + end + + def metal + sample(metals) + end + + def allomancer + sample(allomancers) + end + + def feruchemist + sample(feruchemists) + end + + def herald + sample(heralds) + end + + def spren + sample(sprens) + end + end + end +end diff --git a/lib/locales/en/cosmere.yml b/lib/locales/en/cosmere.yml new file mode 100644 index 0000000000..475a0d43ef --- /dev/null +++ b/lib/locales/en/cosmere.yml @@ -0,0 +1,57 @@ +en: + faker: + cosmere: + aons: [ + 'Aon', 'Aan', 'Aeo', 'Aha', 'Ake', 'Ala', 'Aor', 'Are', 'Ashe', 'Ata', + 'Ate', 'Ati', 'Ato', 'Daa', 'Dao', 'Dii', 'Dio', 'Eda', 'Edo', 'Ehe', + 'Ela', 'Ena', 'Ene', 'Eno', 'Eon', 'Eshe', 'Eto', 'Iad', 'Ido', 'Ien', + 'Iir', 'Ire', 'Kaa', 'Kae', 'Kai', 'Kie', 'Kii', 'Mae', 'Mai', 'Mea', + 'Nae', 'Oed', 'Omi', 'Opa', 'Ope', 'Ore', 'Rao', 'Reo', 'Rii', 'Sao', + 'Sea', 'Seo', 'Shao', 'Sheo', 'Soi', 'Tae', 'Tia', 'Tii', 'Toa' + ] + shard_worlds: [ + 'Ashyn', 'Braize', 'First of the Sun', 'Nalthis', 'Obrodai', 'Roshar', + 'Scadrial', 'Sel', 'Taldain', 'Threnody', 'Vax', 'Yolen' + ] + shards: [ + 'Devotion', 'Dominion', 'Preservation', 'Ruin', 'Odium', 'Cultivation', + 'Honor', 'Endowment', 'Autonomy', 'Ambition', 'Harmony' + ] + surges: [ + 'Abrasion', 'Adhesion', 'Cohesion', 'Division', 'Gravitation', + 'Illumination', 'Progression', 'Transformation', 'Transportation', 'Tension' + ] + knights_radiant: [ + 'Bondsmith', 'Dustbringer', 'Edgedancer', 'Elsecaller', 'Lightweaver', + 'Skybreaker', 'Stoneward', 'Truthwatcher', 'Willshaper', 'Windrunner' + ] + metals: [ + 'Steel', 'Iron', 'Pewter', 'Tin', 'Zinc', 'Brass', 'Copper', Bronze', + 'Duralumin', 'Aluminum', 'Nicrosil', 'Chromium', 'Gold', 'Electrum', + 'Cadmium', 'Bendalloy', 'Atium', 'Lerasium', 'Ettmetal', 'Malatium' + ] + allomancers: [ + 'Mistborn', 'Coinshot', 'Lurcher', 'Pewterarm', 'Tineye', 'Rioter', + 'Soother', 'Smoker', 'Seeker', 'Duralumin Gnat', 'Aluminum Gnat', + 'Nicroburst', 'Leecher', 'Augur', 'Oracle', 'Pulser', 'Slider', 'Seer' + ] + feruchemists: [ + 'Feruchemist', 'Skimmer', 'Steelrunner', 'Windwhisper', 'Brute', 'Sparker', + 'Firesoul', 'Archivist', 'Sentry', 'Spinner', 'Soulbearer', 'Trueself', + 'Connector', 'Gasper', 'Subsumer', 'Bloodmaker', 'Pinnacle' + ] + heralds: [ + 'Jezrien', 'Nale', 'Chanarach', 'Vedel', 'Pailiah', 'Shalash', 'Battar', + 'Kalak', 'Talanel', 'Ishar' + ] + sprens: [ + 'Alespren', 'Angerspren', 'Anticipationspren', 'Awespren', 'Bindspren', + 'Captivityspren', 'Coldspren', 'Concentrationspren', 'Creationspren', + 'Cryptic', 'Cultivationspren', 'Deathspren', 'Decayspren', 'Exhaustionspren', + 'Fearspren', 'Flamespren', 'Gloomspren', 'Gloryspren', 'Gravityspren', + 'Groundspren', 'Heatspren', 'Highspren', 'Honorspren', 'Hungerspren', + 'Inkspren', 'Joyspren', 'Keenspren', 'Laughterspren', 'Liespren', + 'Lifespren', 'Logicspren', 'Luckspren', 'Mistspren', 'Musicspren', + 'Painspren', 'Passionspren', 'Rainspren', 'Riverspren', 'Rotspren', + 'Shamespren', 'Shockspren', 'Stormspren' + ] diff --git a/test/test_faker_cosmere.rb b/test/test_faker_cosmere.rb new file mode 100644 index 0000000000..c5926ffa28 --- /dev/null +++ b/test/test_faker_cosmere.rb @@ -0,0 +1,43 @@ +require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') + +class TestFakerCosmere < Test::Unit::TestCase + def setup + @tester = Faker::Cosmere + end + + def test_aon + assert @tester.aon.match(/\w+\.?/) + end + + def test_shard_world + assert @tester.shard_world.match(/\w+\.?/) + end + + def test_shard + assert @tester.shard.match(/\w+\.?/) + end + + def test_surge + assert @tester.surge.match(/\w+\.?/) + end + + def test_knight_radiant + assert @tester.knight_radiant.match(/\w+\.?/) + end + + def test_metal + assert @tester.metal.match(/\w+\.?/) + end + + def test_allomancer + assert @tester.allomancer.match(/\w+\.?/) + end + + def test_herald + assert @tester.herald.match(/\w+\.?/) + end + + def test_spren + assert @tester.spren.match(/\w+\.?/) + end +end