From 239c59f9b26056a98add8a833c1e4d278b3ec2d6 Mon Sep 17 00:00:00 2001 From: Adsidera Date: Wed, 22 May 2019 13:36:12 +0200 Subject: [PATCH 1/9] added tests and corrected yaml --- lib/faker/opera.rb | 21 +++++ lib/locales/en/opera.yml | 181 +++++++++++++++++++++++++++++++++++++++ test/test_faker_opera.rb | 23 +++++ 3 files changed, 225 insertions(+) create mode 100644 lib/faker/opera.rb create mode 100644 lib/locales/en/opera.yml create mode 100644 test/test_faker_opera.rb diff --git a/lib/faker/opera.rb b/lib/faker/opera.rb new file mode 100644 index 0000000000..03614c8aa4 --- /dev/null +++ b/lib/faker/opera.rb @@ -0,0 +1,21 @@ +module Faker + class Opera < Base + class << self + def verdi + fetch('opera.italian.by_giuseppe_verdi') + end + + def rossini + fetch('opera.italian.by_gioacchino_rossini') + end + + def donizetti + fetch('opera.italian.by_gaetano_donizetti') + end + + def bellini + fetch('opera.italian.by_vincenzo_bellini') + end + end + end +end diff --git a/lib/locales/en/opera.yml b/lib/locales/en/opera.yml new file mode 100644 index 0000000000..22cf8be304 --- /dev/null +++ b/lib/locales/en/opera.yml @@ -0,0 +1,181 @@ +en: + faker: + opera: + italian: + by_giuseppe_verdi: + [ + "Oberto Conte di San Bonifacio", + "Un Giorno di Regno", + "Nabucco", + "Lombardi alla Prima Crociata", + "Ernani", + "I due Foscari", + "Giovanna d'Arco", + "Alzira", + "Attila", + "Macbeth", + "I Masnadieri", + "Jérusalem", + "Il Corsaro", + "La Battaglia di Legnano", + "Luisa Miller", + "Stiffelio", + "Rigoletto", + "Il Trovatore", + "Simon Boccanegra", + "Aroldo", + "Un Ballo in Maschera", + "La Forza del Destino", + "Don Carlos", + "Aida", + "Otello", + "Falstaff", + "I Vespri Siciliani", + "La Traviata", + ] + by_gioacchino_rossini: + [ + "Demetrio e Polibio", + "La cambiale di matrimonio", + "L'equivoco stravagante", + "L'inganno felice", + "Ciro in Babilonia, ossia La caduta di Baldassare", + "La scala di seta", + "La pietra del paragone", + "L'occasione fa il ladro, ossia Il cambio della valigia", + "Il signor Bruschino, ossia Il figlio per azzardo", + "Tancredi", + "L'italiana in Algeri", + "Aureliano in Palmira", + "Il turco in Italia", + "Sigismondo", + "Elisabetta, regina d'Inghilterra", + "Torvaldo e Dorliska", + "Il barbiere di Siviglia, ossia L'inutile precauzione", + "La gazzetta, ossia Il matrimonio per concorso", + "Otello, ossia Il Moro di Venezia", + "La Cenerentola, ossia La bontà in trionfo", + "La gazza ladra", + "Armida", + "Adelaide di Borgogna, ossia Ottone, re d'Italia", + "Mosè in Egitto", + "Adina, ossia Il califfo di Bagdad", + "Ricciardo e Zoraide", + "Ermione", + "Eduardo e Cristina", + "La donna del lago", + "Bianca e Falliero, ossia Il consiglio dei tre", + "Maometto II", + "Matilde di Shabran", + "Zelmira", + "Semiramide", + "Ugo, re d'Italia", + "Il viaggio a Reims, ossia L'albergo del Giglio d'Oro", + "Le siège de Corinthe", + "Moïse et Pharaon, ou Le passage de la mer rouge (revision of Mosè in Egitto)", + "Le comte Ory", + "Guillaume Tell", + ] + by_gaetano_donizetti: + [ + "Olimpiade", + "L'ira di Achille", + "Enrico di Borgogna", + "Una follia", + "I piccioli virtuosi ambulanti", + "Il falegname di Livonia, o Pietro il grande, czar delle Russie", + "Le nozze in villa", + "Zoraida di Granata", + "La zingara", + "La lettera anonima", + "Chiara e Serafina, o Il pirata", + "Alfredo il grande", + "Il fortunato inganno", + "L'ajo nell'imbarazzo", + "Emilia di Liverpool or L'eremitaggio di Liverpool", + "Alahor in Granata", + "Don Gregorio", + "Elvida", + "Gabriella di Vergy", + "Olivo e Pasquale", + "Otto mesi in due ore, ossia Gli esiliati in Siberia", + "Il borgomastro di Saardam", + "Le convenienze teatrali", + "L'esule di Roma, ossia Il proscritto", + "L'eremitaggio di Liverpool", + "Alina, regina di Golconda", + "Gianni di Calais", + "Il paria", + "Il giovedì grasso, o Il nuovo Pourceaugnac", + "Elisabetta al castello di Kenilworth", + "Alina, regina di Golconda[rev]", + "I pazzi per progetto", + "Il diluvio universale", + "Imelda de' Lambertazzi", + "Anna Bolena", + "Gianni di Parigi", + "Le convenienze ed inconvenienze teatrali", + "Francesca di Foix", + "La romanziera e l'uomo nero (or La romanzesca e l'uomo nero)", + "Fausta", + "Ugo, conte di Parigi", + "L'elisir d'amore", + "Sancia di Castiglia", + "Il furioso all'isola di San Domingo", + "Otto mesi in due ore [rev]", + "Parisina", + "Torquato Tasso", + "Lucrezia Borgia", + "Il diluvio universale", + "Rosmonda d'Inghilterra", + "Maria Stuarda", + "Buondelmonte [rev of Maria Stuarda]", + "Gemma di Vergy", + "Marino Faliero", + "Lucia di Lammermoor", + "Belisario", + "Il campanello di notte", + "Betly, o La capanna svizzera", + "L'assedio di Calais", + "Pia de' Tolomei", + "Pia de' Tolomei [rev]", + "Betly [rev]", + "Roberto Devereux", + "Maria de Rudenz", + "Gabriella di Vergy", + "Poliuto", + "Pia de' Tolomei", + "Lucie de Lammermoor [rev of Lucia di Lammermoor, in French]", + "Le duc d'Albe [see also Il duca d'Alba]", + "L'ange de Nisida [see also La favorite]", + "Lucrezia Borgia", + "Les Martyrs", + "La fille du régiment", + "Lucrezia Borgia [rev 2]", + "La favorite [rev of L'ange de Nisida]", + "Adelia", + "Rita (Deux hommes et une femme)", + "Maria Padilla", + "Linda di Chamounix", + "Linda di Chamounix [rev]", + "Caterina Cornaro", + "Don Pasquale", + "Maria di Rohan", + "Dom Sébastien, roi de Portugal", + "Dom Sebastian von Portugal [rev of Dom Sébastien]", + "Il duca d'Alba [completion by Matteo Salvi of original Le duc d'Albe]", + ] + by_vincenzo_bellini: + [ + "Adelson e Salvini", + "Bianca e Gernando", + "Il pirata", + "Bianca e Fernando", + "La straniera", + "Zaira", + "I Capuleti e i Montecchi", + "La sonnambula", + "Norma", + "Beatrice di Tenda", + "I puritani", + ] diff --git a/test/test_faker_opera.rb b/test/test_faker_opera.rb new file mode 100644 index 0000000000..e994223c9b --- /dev/null +++ b/test/test_faker_opera.rb @@ -0,0 +1,23 @@ +require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') + +class TestFakerRuPaul < Test::Unit::TestCase + def setup + @tester = Faker::Opera + end + + def verdi + assert @tester.verdi.match(/\w+/i) + end + + def rossini + assert @tester.rossini.match(/\w+/i) + end + + def donizetti + assert @tester.donizetti.match(/\w+/i) + end + + def bellini + assert @tester.bellini.match(/\w+/i) + end +end From dcbb3a0af2ee6a5a26941ab53ce45b345b7e490f Mon Sep 17 00:00:00 2001 From: Adsidera Date: Wed, 22 May 2019 13:45:06 +0200 Subject: [PATCH 2/9] corrected test --- test/test_faker_opera.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_faker_opera.rb b/test/test_faker_opera.rb index e994223c9b..7be1a9a2a9 100644 --- a/test/test_faker_opera.rb +++ b/test/test_faker_opera.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') -class TestFakerRuPaul < Test::Unit::TestCase +class TestFakerOpera< Test::Unit::TestCase def setup @tester = Faker::Opera end From 6be89ad9abd10bf28127845419140cac6a83762c Mon Sep 17 00:00:00 2001 From: Adsidera Date: Wed, 22 May 2019 13:54:36 +0200 Subject: [PATCH 3/9] fixed missing magic comment and missing spaces --- lib/faker/opera.rb | 3 +++ test/test_faker_opera.rb | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/faker/opera.rb b/lib/faker/opera.rb index 03614c8aa4..5cd385a148 100644 --- a/lib/faker/opera.rb +++ b/lib/faker/opera.rb @@ -1,4 +1,7 @@ +# frozen_string_literal: true + module Faker + # A generator of titles of operas by Verdi, Rossini, Donizetti and Bellini class Opera < Base class << self def verdi diff --git a/test/test_faker_opera.rb b/test/test_faker_opera.rb index 7be1a9a2a9..0d8abc40ef 100644 --- a/test/test_faker_opera.rb +++ b/test/test_faker_opera.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') -class TestFakerOpera< Test::Unit::TestCase +class TestFakerOpera < Test::Unit::TestCase def setup @tester = Faker::Opera end From e89812aa2e4a0058080fcd7792d46cc017c87805 Mon Sep 17 00:00:00 2001 From: Adsidera Date: Wed, 22 May 2019 14:28:14 +0200 Subject: [PATCH 4/9] added dashed array in yml and doc --- doc/opera.md | 8 + lib/faker/opera.rb | 28 ++-- lib/locales/en/opera.yml | 337 +++++++++++++++++++-------------------- 3 files changed, 187 insertions(+), 186 deletions(-) create mode 100644 doc/opera.md diff --git a/doc/opera.md b/doc/opera.md new file mode 100644 index 0000000000..4e1230d51b --- /dev/null +++ b/doc/opera.md @@ -0,0 +1,8 @@ +# Faker::Music::Opera + +```ruby +Faker::Music::Opera.verdi #=> "Il Trovatore" +Faker::Music::Opera.rossini #=> "Il Barbiere di Siviglia" +Faker::Music::Opera.donizetti #=> "Lucia di Lammermoor" +Faker::Music::Opera.bellini #=> "Norma" +``` \ No newline at end of file diff --git a/lib/faker/opera.rb b/lib/faker/opera.rb index 5cd385a148..f16c31f3de 100644 --- a/lib/faker/opera.rb +++ b/lib/faker/opera.rb @@ -2,22 +2,24 @@ module Faker # A generator of titles of operas by Verdi, Rossini, Donizetti and Bellini - class Opera < Base - class << self - def verdi - fetch('opera.italian.by_giuseppe_verdi') - end + class Music + class Opera < Base + class << self + def verdi + fetch('opera.italian.by_giuseppe_verdi') + end - def rossini - fetch('opera.italian.by_gioacchino_rossini') - end + def rossini + fetch('opera.italian.by_gioacchino_rossini') + end - def donizetti - fetch('opera.italian.by_gaetano_donizetti') - end + def donizetti + fetch('opera.italian.by_gaetano_donizetti') + end - def bellini - fetch('opera.italian.by_vincenzo_bellini') + def bellini + fetch('opera.italian.by_vincenzo_bellini') + end end end end diff --git a/lib/locales/en/opera.yml b/lib/locales/en/opera.yml index 22cf8be304..1820e55f03 100644 --- a/lib/locales/en/opera.yml +++ b/lib/locales/en/opera.yml @@ -3,179 +3,170 @@ en: opera: italian: by_giuseppe_verdi: - [ - "Oberto Conte di San Bonifacio", - "Un Giorno di Regno", - "Nabucco", - "Lombardi alla Prima Crociata", - "Ernani", - "I due Foscari", - "Giovanna d'Arco", - "Alzira", - "Attila", - "Macbeth", - "I Masnadieri", - "Jérusalem", - "Il Corsaro", - "La Battaglia di Legnano", - "Luisa Miller", - "Stiffelio", - "Rigoletto", - "Il Trovatore", - "Simon Boccanegra", - "Aroldo", - "Un Ballo in Maschera", - "La Forza del Destino", - "Don Carlos", - "Aida", - "Otello", - "Falstaff", - "I Vespri Siciliani", - "La Traviata", - ] + - Oberto Conte di San Bonifacio + - Un Giorno di Regno + - Nabucco + - Lombardi alla Prima Crociata + - Ernani + - I due Foscari + - Giovanna d'Arco + - Alzira + - Attila + - Macbeth + - I Masnadieri + - Jérusalem + - Il Corsaro + - La Battaglia di Legnano + - Luisa Miller + - Stiffelio + - Rigoletto + - Il Trovatore + - Simon Boccanegra + - Aroldo + - Un Ballo in Maschera + - La Forza del Destino + - Don Carlos + - Aida + - Otello + - Falstaff + - I Vespri Siciliani + - La Traviat by_gioacchino_rossini: - [ - "Demetrio e Polibio", - "La cambiale di matrimonio", - "L'equivoco stravagante", - "L'inganno felice", - "Ciro in Babilonia, ossia La caduta di Baldassare", - "La scala di seta", - "La pietra del paragone", - "L'occasione fa il ladro, ossia Il cambio della valigia", - "Il signor Bruschino, ossia Il figlio per azzardo", - "Tancredi", - "L'italiana in Algeri", - "Aureliano in Palmira", - "Il turco in Italia", - "Sigismondo", - "Elisabetta, regina d'Inghilterra", - "Torvaldo e Dorliska", - "Il barbiere di Siviglia, ossia L'inutile precauzione", - "La gazzetta, ossia Il matrimonio per concorso", - "Otello, ossia Il Moro di Venezia", - "La Cenerentola, ossia La bontà in trionfo", - "La gazza ladra", - "Armida", - "Adelaide di Borgogna, ossia Ottone, re d'Italia", - "Mosè in Egitto", - "Adina, ossia Il califfo di Bagdad", - "Ricciardo e Zoraide", - "Ermione", - "Eduardo e Cristina", - "La donna del lago", - "Bianca e Falliero, ossia Il consiglio dei tre", - "Maometto II", - "Matilde di Shabran", - "Zelmira", - "Semiramide", - "Ugo, re d'Italia", - "Il viaggio a Reims, ossia L'albergo del Giglio d'Oro", - "Le siège de Corinthe", - "Moïse et Pharaon, ou Le passage de la mer rouge (revision of Mosè in Egitto)", - "Le comte Ory", - "Guillaume Tell", - ] + - Demetrio e Polibio + - La cambiale di matrimonio + - L'equivoco stravagante + - L'inganno felice + - Ciro in Babilonia ossia La caduta di Baldassare + - La scala di seta + - La pietra del paragone + - L'occasione fa il ladro ossia Il cambio della valigia + - Il signor Bruschino ossia Il figlio per azzardo + - Tancredi + - L'italiana in Algeri + - Aureliano in Palmira + - Il turco in Italia + - Sigismondo + - Elisabetta regina d'Inghilterra + - Torvaldo e Dorliska + - Il barbiere di Siviglia ossia L'inutile precauzione + - La gazzetta ossia Il matrimonio per concorso + - Otello ossia Il Moro di Venezia + - La Cenerentola ossia La bontà in trionfo + - La gazza ladra + - Armida + - Adelaide di Borgogna ossia Ottone re d'Italia + - Mosè in Egitto + - Adina ossia Il califfo di Bagdad + - Ricciardo e Zoraide + - Ermione + - Eduardo e Cristina + - La donna del lago + - Bianca e Falliero ossia Il consiglio dei tre + - Maometto II + - Matilde di Shabran + - Zelmira + - Semiramide + - Ugo re d'Italia + - Il viaggio a Reims ossia L'albergo del Giglio d'Oro + - Le siège de Corinthe + - Moïse et Pharaon ou Le passage de la mer rouge + - Le comte Ory + - Guillaume Tell by_gaetano_donizetti: - [ - "Olimpiade", - "L'ira di Achille", - "Enrico di Borgogna", - "Una follia", - "I piccioli virtuosi ambulanti", - "Il falegname di Livonia, o Pietro il grande, czar delle Russie", - "Le nozze in villa", - "Zoraida di Granata", - "La zingara", - "La lettera anonima", - "Chiara e Serafina, o Il pirata", - "Alfredo il grande", - "Il fortunato inganno", - "L'ajo nell'imbarazzo", - "Emilia di Liverpool or L'eremitaggio di Liverpool", - "Alahor in Granata", - "Don Gregorio", - "Elvida", - "Gabriella di Vergy", - "Olivo e Pasquale", - "Otto mesi in due ore, ossia Gli esiliati in Siberia", - "Il borgomastro di Saardam", - "Le convenienze teatrali", - "L'esule di Roma, ossia Il proscritto", - "L'eremitaggio di Liverpool", - "Alina, regina di Golconda", - "Gianni di Calais", - "Il paria", - "Il giovedì grasso, o Il nuovo Pourceaugnac", - "Elisabetta al castello di Kenilworth", - "Alina, regina di Golconda[rev]", - "I pazzi per progetto", - "Il diluvio universale", - "Imelda de' Lambertazzi", - "Anna Bolena", - "Gianni di Parigi", - "Le convenienze ed inconvenienze teatrali", - "Francesca di Foix", - "La romanziera e l'uomo nero (or La romanzesca e l'uomo nero)", - "Fausta", - "Ugo, conte di Parigi", - "L'elisir d'amore", - "Sancia di Castiglia", - "Il furioso all'isola di San Domingo", - "Otto mesi in due ore [rev]", - "Parisina", - "Torquato Tasso", - "Lucrezia Borgia", - "Il diluvio universale", - "Rosmonda d'Inghilterra", - "Maria Stuarda", - "Buondelmonte [rev of Maria Stuarda]", - "Gemma di Vergy", - "Marino Faliero", - "Lucia di Lammermoor", - "Belisario", - "Il campanello di notte", - "Betly, o La capanna svizzera", - "L'assedio di Calais", - "Pia de' Tolomei", - "Pia de' Tolomei [rev]", - "Betly [rev]", - "Roberto Devereux", - "Maria de Rudenz", - "Gabriella di Vergy", - "Poliuto", - "Pia de' Tolomei", - "Lucie de Lammermoor [rev of Lucia di Lammermoor, in French]", - "Le duc d'Albe [see also Il duca d'Alba]", - "L'ange de Nisida [see also La favorite]", - "Lucrezia Borgia", - "Les Martyrs", - "La fille du régiment", - "Lucrezia Borgia [rev 2]", - "La favorite [rev of L'ange de Nisida]", - "Adelia", - "Rita (Deux hommes et une femme)", - "Maria Padilla", - "Linda di Chamounix", - "Linda di Chamounix [rev]", - "Caterina Cornaro", - "Don Pasquale", - "Maria di Rohan", - "Dom Sébastien, roi de Portugal", - "Dom Sebastian von Portugal [rev of Dom Sébastien]", - "Il duca d'Alba [completion by Matteo Salvi of original Le duc d'Albe]", - ] + - Olimpiade + - L'ira di Achille + - Enrico di Borgogna + - Una follia + - I piccioli virtuosi ambulanti + - Il falegname di Livonia o Pietro il grande czar delle Russie + - Le nozze in villa + - Zoraida di Granata + - La zingara + - La lettera anonima + - Chiara e Serafina o Il pirata + - Alfredo il grande + - Il fortunato inganno + - L'ajo nell'imbarazzo + - Emilia di Liverpool or L'eremitaggio di Liverpool + - Alahor in Granata + - Don Gregorio + - Elvida + - Gabriella di Vergy + - Olivo e Pasquale + - Otto mesi in due ore ossia Gli esiliati in Siberia + - Il borgomastro di Saardam + - Le convenienze teatrali + - L'esule di Roma ossia Il proscritto + - L'eremitaggio di Liverpool + - Alina regina di Golconda + - Gianni di Calais + - Il paria + - Il giovedì grasso o Il nuovo Pourceaugnac + - Elisabetta al castello di Kenilworth + - Alina regina di Golconda[rev] + - I pazzi per progetto + - Il diluvio universale + - Imelda de' Lambertazzi + - Anna Bolena + - Gianni di Parigi + - Le convenienze ed inconvenienze teatrali + - Francesca di Foix + - La romanziera e l'uomo nero + - Fausta + - Ugo conte di Parigi + - L'elisir d'amore + - Sancia di Castiglia + - Il furioso all'isola di San Domingo + - Otto mesi in due ore + - Parisina + - Torquato Tasso + - Lucrezia Borgia + - Il diluvio universale + - Rosmonda d'Inghilterra + - Maria Stuarda + - Buondelmonte + - Gemma di Vergy + - Marino Faliero + - Lucia di Lammermoor + - Belisario + - Il campanello di notte + - Betly o La capanna svizzera + - L'assedio di Calais + - Pia de' Tolomei + - Pia de' Tolomei + - Betly + - Roberto Devereux + - Maria de Rudenz + - Gabriella di Vergy + - Poliuto + - Pia de' Tolomei + - Lucie de Lammermoor + - Le duc d'Albe + - L'ange de Nisida + - Lucrezia Borgia + - Les Martyrs + - La fille du régiment + - Lucrezia Borgia + - La favorite + - Adelia + - Rita + - Maria Padilla + - Linda di Chamounix + - Caterina Cornaro + - Don Pasquale + - Maria di Rohan + - Dom Sébastien roi de Portugal + - Dom Sebastian von Portugal + - Il duca d'Alba by_vincenzo_bellini: - [ - "Adelson e Salvini", - "Bianca e Gernando", - "Il pirata", - "Bianca e Fernando", - "La straniera", - "Zaira", - "I Capuleti e i Montecchi", - "La sonnambula", - "Norma", - "Beatrice di Tenda", - "I puritani", - ] + - Adelson e Salvini + - Bianca e Gernando + - Il pirata + - Bianca e Fernando + - La straniera + - Zaira + - I Capuleti e i Montecchi + - La sonnambula + - Norma + - Beatrice di Tenda + - I puritani From b904e65e9555eadb2843c45411d457786787a8c1 Mon Sep 17 00:00:00 2001 From: Adsidera Date: Thu, 30 May 2019 11:04:10 +0200 Subject: [PATCH 5/9] moved opera.md to doc/music/opera.md and added link to it in ureleased_README --- doc/{ => music}/opera.md | 0 unreleased_README.md | 369 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 369 insertions(+) rename doc/{ => music}/opera.md (100%) create mode 100644 unreleased_README.md diff --git a/doc/opera.md b/doc/music/opera.md similarity index 100% rename from doc/opera.md rename to doc/music/opera.md diff --git a/unreleased_README.md b/unreleased_README.md new file mode 100644 index 0000000000..1a8d069527 --- /dev/null +++ b/unreleased_README.md @@ -0,0 +1,369 @@ + +![logotype a happy-07](https://user-images.githubusercontent.com/36028424/40263395-4318481e-5b44-11e8-92e5-3dcc1ce169b3.png) + +# Faker +[![Build Status](https://travis-ci.org/stympy/faker.svg?branch=master)](https://travis-ci.org/stympy/faker) +[![Gem Version](https://badge.fury.io/rb/faker.svg)](https://badge.fury.io/rb/faker) +[![Inline docs](http://inch-ci.org/github/stympy/faker.svg?branch=master)](http://inch-ci.org/github/stympy/faker) +[![Test Coverage](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/test_coverage)](https://codeclimate.com/github/stympy/faker/test_coverage) +[![Maintainability](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/maintainability)](https://codeclimate.com/github/stympy/faker/maintainability) + +This gem is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker) that generates fake data. + +It comes in very handy for taking screenshots (taking screenshots for my +project, [Catch the Best](http://catchthebest.com/) was the original impetus +for the creation of this gem), having real-looking test data, and having your +database populated with more than one or two records while you're doing +development. + +- [Faker](#faker) + - [NOTE](#note) + - [Installing](#installing) + - [Usage](#usage) + - [CLI](#cli) + - [Ensuring unique values](#ensuring-unique-values) + - [Deterministic Random](#deterministic-random) + - [Generators](#generators) + - [Default](#default) + - [Blockchain](#blockchain) + - [Books](#books) + - [Creature](#creature) + - [Games](#games) + - [Japanese Media](#japanese-media) + - [Movies](#movies) + - [Music](#music) + - [Quotes](#quotes) + - [Sports](#sports) + - [Tv Shows](#tv-shows) + - [Customization](#customization) + - [Contributing](#contributing) + - [Contact](#contact) + - [License](#license) + +### NOTE +* While Faker generates data at random, returned values are not guaranteed to be unique by default. + You must explicity specify when you require unique values, see [details](#ensuring-unique-values). + Values also can be deterministic if you use the deterministic feature, see [details](#deterministic-random) +* This is the `master` branch of Faker and may contain changes that are not yet released. + Please refer the README of your version for the available methods. + List of all versions is [available here](https://github.com/stympy/faker/releases). + +## Installing +```bash +gem install faker +``` +Note: if you are getting a `uninitialized constant Faker::[some_class]` error, your version of the gem is behind the one documented here. To make sure that your gem is the one documented here, change the line in your Gemfile to: + +```ruby +gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master' +``` + +## Usage +```ruby +require 'faker' + +Faker::Name.name #=> "Christophe Bartell" + +Faker::Internet.email #=> "kirsten.greenholt@corkeryfisher.info" +``` + +### CLI + +Usage Instructions [available here](https://github.com/stympy/faker/blob/master/lib/cli/README.md) + +```bash +$ faker +``` + +### Ensuring unique values +Prefix your method call with `unique`. For example: +```ruby +Faker::Name.unique.name # This will return a unique name every time it is called +``` + +If too many unique values are requested from a generator that has a limited +number of potential values, a `Faker::UniqueGenerator::RetryLimitExceeded` +exception may be raised. It is possible to clear the record of unique values +that have been returned, for example between tests. +```ruby +Faker::Name.unique.clear # Clears used values for Faker::Name +Faker::UniqueGenerator.clear # Clears used values for all generators +``` + +You also can give some already used values to the unique generator if you have +collisions with the generated data (i.e: using FactoryBot with random and +manually set values). + +```ruby +# Usage: +# Faker::.unique.exclude(method, arguments, list) + +# Add 'azerty' and 'wxcvbn' to the string generator with 6 char length +Faker::Lorem.unique.exclude :string, [6], %w[azerty wxcvbn] +``` + +### Deterministic Random +Faker supports seeding of its pseudo-random number generator (PRNG) to provide deterministic output of repeated method calls. + +```ruby +Faker::Config.random = Random.new(42) +Faker::Company.bs #=> "seize collaborative mindshare" +Faker::Company.bs #=> "engage strategic platforms" +Faker::Config.random = Random.new(42) +Faker::Company.bs #=> "seize collaborative mindshare" +Faker::Company.bs #=> "engage strategic platforms" + +Faker::Config.random = nil # seeds the PRNG using default entropy sources +Faker::Config.random.seed #=> 185180369676275068918401850258677722187 +Faker::Company.bs #=> "cultivate viral synergies" +``` + +## Generators +**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:** + +```ruby +gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master' +``` + +### Default + - [Faker::Address](doc/unreleased/default/address.md) + - [Faker::Alphanumeric](doc/unreleased/default/alphanumeric.md) + - [Faker::Ancient](doc/unreleased/default/ancient.md) + - [Faker::App](doc/unreleased/default/app.md) + - [Faker::Appliance](doc/unreleased/default/appliance.md) + - [Faker::Artist](doc/unreleased/default/artist.md) + - [Faker::Avatar](doc/unreleased/default/avatar.md) + - [Faker::Bank](doc/unreleased/default/bank.md) + - [Faker::Beer](doc/unreleased/default/beer.md) + - [Faker::Boolean](doc/unreleased/default/boolean.md) + - [Faker::BossaNova](doc/unreleased/default/bossa_nova.md) + - [Faker::Business](doc/unreleased/default/business.md) + - [Faker::Cannabis](doc/unreleased/default/cannabis.md) + - [Faker::ChileRut](doc/unreleased/default/chile_rut.md) + - [Faker::ChuckNorris](doc/unreleased/default/chuck_norris.md) + - [Faker::Code](doc/unreleased/default/code.md) + - [Faker::Coffee](doc/unreleased/default/coffee.md) + - [Faker::Coin](doc/unreleased/default/coin.md) + - [Faker::Color](doc/unreleased/default/color.md) + - [Faker::Commerce](doc/unreleased/default/commerce.md) + - [Faker::Company](doc/unreleased/default/company.md) + - [Faker::Compass](doc/unreleased/default/compass.md) + - [Faker::Construction](doc/unreleased/default/construction.md) + - [Faker::Cosmere](doc/unreleased/default/cosmere.md) + - [Faker::Crypto](doc/unreleased/default/crypto.md) + - [Faker::CryptoCoin](doc/unreleased/default/crypto_coin.md) + - [Faker::Currency](doc/unreleased/default/currency.md) + - [Faker::Date](doc/unreleased/default/date.md) + - [Faker::DcComics](doc/unreleased/default/dc_comics.md) + - [Faker::Demographic](doc/unreleased/default/demographic.md) + - [Faker::Dessert](doc/unreleased/default/dessert.md) + - [Faker::Device](doc/unreleased/default/device.md) + - [Faker::DrivingLicence](doc/unreleased/default/driving_licence.md) + - [Faker::Educator](doc/unreleased/default/educator.md) + - [Faker::ElectricalComponents](doc/unreleased/default/electrical_components.md) + - [Faker::Esport](doc/unreleased/default/esport.md) + - [Faker::File](doc/unreleased/default/file.md) + - [Faker::Fillmurray](doc/unreleased/default/fillmurray.md) + - [Faker::Finance](doc/unreleased/default/finance.md) + - [Faker::Food](doc/unreleased/default/food.md) + - [Faker::Football](doc/unreleased/default/football.md) + - [Faker::FunnyName](doc/unreleased/default/funny_name.md) + - [Faker::Gender](doc/unreleased/default/gender.md) + - [Faker::GreekPhilosophers](doc/unreleased/default/greek_philosophers.md) + - [Faker::Hacker](doc/unreleased/default/hacker.md) + - [Faker::Hipster](doc/unreleased/default/hipster.md) + - [Faker::House](doc/unreleased/default/house.md) + - [Faker::IDNumber](doc/unreleased/default/id_number.md) + - [Faker::IndustrySegments](doc/unreleased/default/industry_segments.md) + - [Faker::Internet](doc/unreleased/default/internet.md) + - [Faker::Invoice](doc/unreleased/default/invoice.md) + - [Faker::Job](doc/unreleased/default/job.md) + - [Faker::Json](doc/unreleased/default/json.md) + - [Faker::Kpop](doc/unreleased/default/kpop.md) + - [Faker::Lorem](doc/unreleased/default/lorem.md) + - [Faker::LoremFlickr](doc/unreleased/default/lorem_flickr.md) + - [Faker::LoremPixel](doc/unreleased/default/lorem_pixel.md) + - [Faker::Markdown](doc/unreleased/default/markdown.md) + - [Faker::Marketing](doc/unreleased/default/marketing.md) + - [Faker::Measurement](doc/unreleased/default/measurement.md) + - [Faker::Military](doc/unreleased/default/military.md) + - [Faker::Name](doc/unreleased/default/name.md) + - [Faker::Nation](doc/unreleased/default/nation.md) + - [Faker::NatoPhoneticAlphabet](doc/unreleased/default/nato_phonetic_alphabet.md) + - [Faker::NationalHealthService](doc/unreleased/default/national_health_service.md) + - [Faker::Number](doc/unreleased/default/number.md) + - [Faker::Omniauth](doc/unreleased/default/omniauth.md) + - [Faker::PhoneNumber](doc/unreleased/default/phone_number.md) + - [Faker::Placeholdit](doc/unreleased/default/placeholdit.md) + - [Faker::ProgrammingLanguage](doc/unreleased/default/programming_language.md) + - [Faker::Relationship](doc/unreleased/default/relationship.md) + - [Faker::Restaurant](doc/unreleased/default/restaurant.md) + - [Faker::Science](doc/unreleased/default/science.md) + - [Faker::SlackEmoji](doc/unreleased/default/slack_emoji.md) + - [Faker::Source](doc/unreleased/default/source.md) + - [Faker::SouthAfrica](doc/unreleased/default/south_africa.md) + - [Faker::Space](doc/unreleased/default/space.md) + - [Faker::String](doc/unreleased/default/string.md) + - [Faker::Stripe](doc/unreleased/default/stripe.md) + - [Faker::Subscription](doc/unreleased/default/subscription.md) + - [Faker::Superhero](doc/unreleased/default/superhero.md) + - [Faker::Team](doc/unreleased/default/team.md) + - [Faker::Time](doc/unreleased/default/time.md) + - [Faker::Twitter](doc/unreleased/default/twitter.md) + - [Faker::Types](doc/unreleased/default/types.md) + - [Faker::University](doc/unreleased/default/university.md) + - [Faker::Vehicle](doc/unreleased/default/vehicle.md) + - [Faker::Verbs](doc/unreleased/default/verbs.md) + - [Faker::WorldCup](doc/unreleased/default/world_cup.md) + +### Blockchain + - [Faker::Blockchain::Bitcoin](doc/unreleased/blockchain/bitcoin.md) + - [Faker::Blockchain::Ethereum](doc/unreleased/blockchain/ethereum.md) + - [Faker::Blockchain::Tezos](doc/unreleased/blockchain/tezos.md) + +### Books + - [Faker::Book](doc/unreleased/books/book.md) + - [Faker::Books::CultureSeries](doc/unreleased/books/culture_series.md) + - [Faker::Books::Dune](doc/unreleased/books/dune.md) + - [Faker::Books::Lovecraft](doc/unreleased/books/lovecraft.md) + +### Creature + - [Faker::Creature::Animal](doc/unreleased/creature/animal.md) + - [Faker::Creature::Cat](doc/unreleased/creature/cat.md) + - [Faker::Creature::Dog](doc/unreleased/creature/dog.md) + - [Faker::Creature::Horse](doc/unreleased/creature/horse.md) + +### Games + - [Faker::Game](doc/games/game.md) + - [Faker::Games::Dota](doc/unreleased/games/dota.md) + - [Faker::Games::ElderScrolls](doc/unreleased/games/elder_scrolls.md) + - [Faker::Games::Fallout](doc/unreleased/games/fallout.md) + - [Faker::Games::HalfLife](doc/unreleased/games/half_life.md) + - [Faker::Games::Heroes](doc/unreleased/games/heroes.md) + - [Faker::Games::HeroesOfTheStorm](doc/unreleased/games/heroes_of_the_storm.md) + - [Faker::Games::LeagueOfLegends](doc/unreleased/games/league_of_legends.md) + - [Faker::Games::Myst](doc/unreleased/games/myst.md) + - [Faker::Games::Overwatch](doc/unreleased/games/overwatch.md) + - [Faker::Games::Pokemon](doc/unreleased/games/pokemon.md) + - [Faker::Games::SonicTheHedgehog](doc/unreleased/games/sonic_the_hedgehog.md) + - [Faker::Games::SuperSmashBros](doc/unreleased/games/super_smash_bros.md) + - [Faker::Games::Witcher](doc/unreleased/games/witcher.md) + - [Faker::Games::WorldOfWarcraft](doc/unreleased/games/world_of_warcraft.md) + - [Faker::Games::Zelda](doc/unreleased/games/zelda.md) + +### Japanese Media + - [Faker::JapaneseMedia::DragonBall](doc/unreleased/japanese_media/dragon_ball.md) + - [Faker::JapaneseMedia::OnePiece](doc/unreleased/japanese_media/one_piece.md) + - [Faker::JapaneseMedia::SwordArtOnline](doc/unreleased/japanese_media/sword_art_online.md) + +### Movies + - [Faker::Movie](doc/unreleased/movies/movie.md) + - [Faker::Movies::BackToTheFuture](doc/unreleased/movies/back_to_the_future.md) + - [Faker::Movies::Ghostbusters](doc/unreleased/movies/ghostbusters.md) + - [Faker::Movies::HarryPotter](doc/unreleased/movies/harry_potter.md) + - [Faker::Movies::HitchhikersGuideToTheGalaxy](doc/unreleased/movies/hitchhikers_guide_to_the_galaxy.md) + - [Faker::Movies::Hobbit](doc/unreleased/movies/hobbit.md) + - [Faker::Movies::Lebowski](doc/unreleased/movies/lebowski.md) + - [Faker::Movies::LordOfTheRings](doc/unreleased/movies/lord_of_the_rings.md) + - [Faker::Movies::PrincessBride](doc/unreleased/movies/princess_bride.md) + - [Faker::Movies::StarWars](doc/unreleased/movies/star_wars.md) + - [Faker::Movies::VForVendetta](doc/unreleased/movies/v_for_vendetta.md) + +### Music + - [Faker::Music](doc/unreleased/music/music.md) + - [Faker::Music::GratefulDead](doc/music/grateful_dead.md) + - [Faker::Music::Opera](doc/music/opera.md) + - [Faker::Music::Phish](doc/unreleased/music/phish.md) + - [Faker::Music::RockBand](doc/unreleased/music/rock_band.md) + - [Faker::Music::UmphreysMcgee](doc/unreleased/music/umphreys_mcgee.md) + +### Quotes + - [Faker::Quote](doc/unreleased/quotes/quote.md) + - [Faker::Quotes::Shakespeare](doc/unreleased/quotes/shakespeare.md) + +### Sports + - [Faker::Sports::Basketball](doc/unreleased/sports/basketball.md) + - [Faker::Sports::Football](doc/unreleased/sports/football.md) + +### Tv Shows + - [Faker::TvShows::AquaTeenHungerForce](doc/unreleased/tv_shows/aqua_teen_hunger_force.md) + - [Faker::TvShows::BojackHorseman](doc/unreleased/tv_shows/bojack_horseman.md) + - [Faker::TvShows::BreakingBad](doc/unreleased/tv_shows/breaking_bad.md) + - [Faker::TvShows::Buffy](doc/unreleased/tv_shows/buffy.md) + - [Faker::TvShows::Community](doc/unreleased/tv_shows/community.md) + - [Faker::TvShows::DrWho](doc/unreleased/tv_shows/dr_who.md) + - [Faker::TvShows::DumbAndDumber](doc/unreleased/tv_shows/dumb_and_dumber.md) + - [Faker::TvShows::FamilyGuy](doc/unreleased/tv_shows/family_guy.md) + - [Faker::TvShows::Friends](doc/unreleased/tv_shows/friends.md) + - [Faker::TvShows::GameOfThrones](doc/unreleased/tv_shows/game_of_thrones.md) + - [Faker::TvShows::HeyArnold](doc/unreleased/tv_shows/hey_arnold.md) + - [Faker::TvShows::HowIMetYourMother](doc/unreleased/tv_shows/how_i_met_your_mother.md) + - [Faker::TvShows::MichaelScott](doc/unreleased/tv_shows/michael_scott.md) + - [Faker::TvShows::NewGirl](doc/unreleased/tv_shows/new_girl.md) + - [Faker::TvShows::ParksAndRec](doc/unreleased/tv_shows/parks_and_rec.md) + - [Faker::TvShows::RickAndMorty](doc/unreleased/tv_shows/rick_and_morty.md) + - [Faker::TvShows::RuPaul](doc/unreleased/tv_shows/rupaul.md) + - [Faker::TvShows::Seinfeld](doc/unreleased/tv_shows/seinfeld.md) + - [Faker::TvShows::SiliconValley](doc/unreleased/tv_shows/silicon_valley.md) + - [Faker::TvShows::Simpsons](doc/unreleased/tv_shows/simpsons.md) + - [Faker::TvShows::SouthPark](doc/unreleased/tv_shows/south_park.md) + - [Faker::TvShows::StarTrek](doc/unreleased/tv_shows/star_trek.md) + - [Faker::TvShows::Stargate](doc/unreleased/tv_shows/stargate.md) + - [Faker::TvShows::StrangerThings](doc/unreleased/tv_shows/stranger_things.md) + - [Faker::TvShows::TheExpanse](doc/unreleased/tv_shows/the_expanse.md) + - [Faker::TvShows::TheFreshPrinceOfBelAir](doc/unreleased/tv_shows/the_fresh_prince_of_bel_air.md) + - [Faker::TvShows::TheITCrowd](doc/unreleased/tv_shows/the_it_crowd.md) + - [Faker::TvShows::TheThickOfIt](doc/unreleased/tv_shows/the_thick_of_it.md) + - [Faker::TvShows::TwinPeaks](doc/unreleased/tv_shows/twin_peaks.md) + - [Faker::TvShows::VentureBros](doc/unreleased/tv_shows/venture_bros.md) + +## Customization +Since you may want to make addresses and other types of data look different +depending on where in the world you are (US postal codes vs. UK postal codes, +for example), Faker uses the I18n gem to store strings (like state names) and +formats (US postal codes are NNNNN while UK postal codes are AAN NAA), +allowing you to get different formats by switching locales. Just set +Faker::Config.locale to the locale you want, and Faker will take care of the +rest. + +If your locale doesn't already exist, create it in the `lib/locales` directory +and you can then override or add elements to suit your needs. See more about how to +use locales [here](lib/locales/README.md) + +```yaml +en-au-ocker: + faker: + name: + # Existing faker field, new data + first_name: + - Charlotte + - Ava + - Chloe + - Emily + + # New faker fields + ocker_first_name: + - Bazza + - Bluey + - Davo + - Johno + - Shano + - Shazza + region: + - South East Queensland + - Wide Bay Burnett + - Margaret River + - Port Pirie + - Gippsland + - Elizabeth + - Barossa +``` + +## Contributing +See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/master/CONTRIBUTING.md). + +## Contact +Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker). + +## License +This code is free to use under the terms of the MIT license. \ No newline at end of file From 51918ce27e2a688467beb0f028773b0a15bc01eb Mon Sep 17 00:00:00 2001 From: Adsidera Date: Thu, 30 May 2019 11:23:13 +0200 Subject: [PATCH 6/9] moved test_faker_opera to faker/music directory --- lib/faker/{ => music}/opera.rb | 0 test/{ => faker/music}/test_faker_opera.rb | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename lib/faker/{ => music}/opera.rb (100%) rename test/{ => faker/music}/test_faker_opera.rb (100%) diff --git a/lib/faker/opera.rb b/lib/faker/music/opera.rb similarity index 100% rename from lib/faker/opera.rb rename to lib/faker/music/opera.rb diff --git a/test/test_faker_opera.rb b/test/faker/music/test_faker_opera.rb similarity index 100% rename from test/test_faker_opera.rb rename to test/faker/music/test_faker_opera.rb From 0af72c87669e753dfcc4a56dbada8fcd8be6c2a4 Mon Sep 17 00:00:00 2001 From: Adsidera Date: Thu, 30 May 2019 14:51:55 +0200 Subject: [PATCH 7/9] corrected path to test_helper in test_faker_opera.rb --- test/faker/music/test_faker_opera.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/faker/music/test_faker_opera.rb b/test/faker/music/test_faker_opera.rb index 0d8abc40ef..a05b0fcd3f 100644 --- a/test/faker/music/test_faker_opera.rb +++ b/test/faker/music/test_faker_opera.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') +require_relative '../../test_helper' class TestFakerOpera < Test::Unit::TestCase def setup - @tester = Faker::Opera + @tester = Faker::Music::Opera end def verdi From 6515d09bc2299450f4d1b35b211fc3105632929f Mon Sep 17 00:00:00 2001 From: Adsidera Date: Wed, 5 Jun 2019 09:10:35 +0200 Subject: [PATCH 8/9] moved opera.md to doc unreleased --- doc/{ => unreleased}/music/opera.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{ => unreleased}/music/opera.md (100%) diff --git a/doc/music/opera.md b/doc/unreleased/music/opera.md similarity index 100% rename from doc/music/opera.md rename to doc/unreleased/music/opera.md From b226262f3fecdd86108a959f0ed243e73dcc8122 Mon Sep 17 00:00:00 2001 From: Adsidera Date: Wed, 5 Jun 2019 09:22:41 +0200 Subject: [PATCH 9/9] restarted pr --- doc/unreleased/music/opera.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/unreleased/music/opera.md b/doc/unreleased/music/opera.md index 4e1230d51b..37b9170936 100644 --- a/doc/unreleased/music/opera.md +++ b/doc/unreleased/music/opera.md @@ -5,4 +5,4 @@ Faker::Music::Opera.verdi #=> "Il Trovatore" Faker::Music::Opera.rossini #=> "Il Barbiere di Siviglia" Faker::Music::Opera.donizetti #=> "Lucia di Lammermoor" Faker::Music::Opera.bellini #=> "Norma" -``` \ No newline at end of file +```