From 9e47c3a5b4921bdb3bca57c44ba9ff46e456c548 Mon Sep 17 00:00:00 2001 From: Eli Sadoff <9064062+snood1205@users.noreply.github.com> Date: Tue, 20 Apr 2021 19:05:14 -0400 Subject: [PATCH 1/4] Add Faker::Tea (#2190) * Add tea * Change #to_h with block to #map(block).to_h for Ruby 2.5 * Apply code review suggestions per @koic * More PR adjustments --- README.md | 1 + doc/default/tea.md | 15 +++ lib/faker/default/tea.rb | 41 +++++++ lib/locales/en/tea.yml | 172 +++++++++++++++++++++++++++ test/faker/default/test_faker_tea.rb | 31 +++++ 5 files changed, 260 insertions(+) create mode 100644 doc/default/tea.md create mode 100644 lib/faker/default/tea.rb create mode 100644 lib/locales/en/tea.yml create mode 100644 test/faker/default/test_faker_tea.rb diff --git a/README.md b/README.md index ca857bbf5a..14ffb34750 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast - [Faker::Stripe](doc/default/stripe.md) - [Faker::Subscription](doc/default/subscription.md) - [Faker::Superhero](doc/default/superhero.md) + - [Faker::Tea](doc/default/tea.md) - [Faker::Team](doc/default/team.md) - [Faker::Time](doc/default/time.md) - [Faker::Twitter](doc/default/twitter.md) diff --git a/doc/default/tea.md b/doc/default/tea.md new file mode 100644 index 0000000000..bb88784f5e --- /dev/null +++ b/doc/default/tea.md @@ -0,0 +1,15 @@ +# Faker::Tea + +Available since version next. + +```ruby +# Get a tea variety +Faker::Tea.variety # => "Earl Grey" + +# Get a tea variety, by type of tea. Accepted types: +# ['Black', 'Green', 'Herbal', 'Oolong', 'White'] +Faker::Tea.variety(type: 'Green') #=> "Jasmine" + +# Get a type of tea +Faker::Tea.type #=> "Herbal" +``` diff --git a/lib/faker/default/tea.rb b/lib/faker/default/tea.rb new file mode 100644 index 0000000000..006b26e0f1 --- /dev/null +++ b/lib/faker/default/tea.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Faker + class Tea < Base + flexible :tea + + class << self + ## + # Produces a random variety or blend of tea. + # + # @param type [String, nil] the type of tea to query for (valid types: 'Black', 'Green', 'Oolong', 'White', and 'Herbal') + # @return [String] a variety of tea + # + # @example + # Faker::Tea.variety + # #=> "Earl Grey" + # + # @example + # Faker::Tea.variety(type: 'Green') + # #=> "Jasmine" + # @faker.version next + def variety(type: nil) + type ||= fetch('tea.type') + fetch "tea.variety.#{type.downcase}" + end + + ## + # Produces a random type of tea. + # + # @return [String] a type of tea + # + # @example + # Faker::Tea.type + # #=> "Green" + # @faker.version next + def type + fetch 'tea.type' + end + end + end +end diff --git a/lib/locales/en/tea.yml b/lib/locales/en/tea.yml new file mode 100644 index 0000000000..4de0891f9a --- /dev/null +++ b/lib/locales/en/tea.yml @@ -0,0 +1,172 @@ +en: + faker: + tea: + variety: + black: + - Assam + - Ceylon + - Congou + - Darjeeling + - Dianhong + - Earl Grey + - English Afternoon + - English Breakfast + - Irish Breakfast + - Jaekseol + - Jiu Qu Hong Mei + - Kangra + - Keemun + - Lady Grey + - Lahijan + - Lapsang Souchong + - Masala Chai + - Munnar + - Nepali + - Nilgiri + - Rize + - Scottish Breakfast + - Sun Moon Lake + - Yingdehong + oolong: + - Alishan + - Bai Jiguan + - Da Hong Pao + - Dancong + - Dongding + - Dongfang Meiren + - Fujian + - Gaoshan + - Huangjin Gui + - Ji Xuan + - Lishan + - Pouchong + - Rougui + - Ruan Zhi + - Shui Jin Gui + - Shui Xian + - Tieguanyin + - Tieluohan + - Tienguanyin + - Vietnamese + green: + - Bancha + - Biluochun + - Chun Mee + - Daejak + - Garucha + - Genmaicha + - Gunpowder + - Gyokuro + - Hojicha + - Huangshan Maofeng + - Ipcha + - Jungjak + - Kabusecha + - Kukicha + - Longjing + - Lu'an Melon Seed + - Matcha + - Sejak + - Sencha + - Shincha + - Taipin Houkui + - Ujeon + - Xinyang Maojian + white: + - Bai Mu Dan + - Fujian New Craft + - Gongmei + - Shou Mei + - Yi Zhen Bai Hao + herbal: + - Anise + - Asiatic Penny-Wort + - Bael Fruit + - Barley + - Bee Balm + - Boldo + - Burdock + - Cacao + - Caraway + - Cat's Claw + - Catnip + - Cerasse + - Chamomile + - Che Dang + - Chinese Knot-Weed + - Chrysanthemum + - Cinnamon + - Citrus Peel + - Dandelion + - Dill + - Dried Lime + - Echinacea + - Elderberry + - Essiac + - European Mistletoe + - Fennel + - Gentian + - Ginger Root + - Ginseng + - Goji + - Hawthorn + - Hibiscus + - Honeybush + - Horehound + - Houttuynia + - Jiaogulan + - Kapor + - Kuzuyu + - Labrador + - Lemon Balm + - Lemon Ginger + - Lemon Grass + - Licorice Root + - Lime Blossom + - Luo Han Guo + - Mint + - Moringa + - Mountain Tea + - Neem + - Nettle + - New Jersey Tea + - Noni + - Oksusu Cha + - Olive Leaf + - Osmanthus + - Pandan + - Patchouli + - Pine + - Qishr + - Red Clover + - Red Raspberry + - Roasted Wheat + - Rooibos + - Rose Hip + - Roselle + - Rosemary + - Sage + - Sagebrush + - Serendib + - Skurayu + - Sobacha + - Spearmint + - Spicebush + - Spruce + - St. John's Wort + - Thyme + - Tulsi + - Turmeric + - Valerian + - Verbena + - Vetiver + - Wax Gourd + - Wong Lo Kat + - Woodruff + - Yarrow + type: + - Black + - Oolong + - Green + - White + - Herbal diff --git a/test/faker/default/test_faker_tea.rb b/test/faker/default/test_faker_tea.rb new file mode 100644 index 0000000000..1e2e6cc36f --- /dev/null +++ b/test/faker/default/test_faker_tea.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require_relative '../../test_helper' + +class TestFakerTea < Test::Unit::TestCase + def setup + @tester = Faker::Tea + @types = Faker::Base.fetch_all('tea.type') + @varieties_by_type = @types.map do |type| + [type, Faker::Base.fetch_all("tea.variety.#{type.downcase}")] + end.to_h + @varieties = @varieties_by_type.values.flatten + end + + def test_variety + assert(@varieties.all? do |variety| + variety.match?(/^(?:[A-Z]['.\-a-z]+[\s-])*(?:[A-Z]['.\-a-z]+)$/) + end) + assert @varieties.include?(@tester.variety) + end + + def test_variety_with_argument + @types.each do |type| + assert @varieties_by_type[type].include?(@tester.variety(type: type)) + end + end + + def test_types + assert @types.all? { |type| type.match?(/^[A-Z][a-z]+$/) } + end +end From 5b88b36ac67db4c758934a0835a151dea6fb8e21 Mon Sep 17 00:00:00 2001 From: Thomas Adriaan Hellinger Date: Wed, 21 Apr 2021 06:06:54 -0400 Subject: [PATCH 2/4] Add birds (#2299) * added tests for all simple bird look-ups * added bird words (bird is the word) * added birds! * added tests for plausible and implausible common names for birds and correcting tests for adjectives and common_name roots * added .plausible_common_name and .implausible_common_name and made .common_name string be lowercase * added documentation of bird methods * corrected Rubocop offenses and made test failures on #test_plausible_common_names and #test_implausible_common_names more clear * fixed TestFakerCreatureBird#test_plausible_common_names to allow for names like "Painted bunting" * Apply suggestions from code review Co-authored-by: Koichi ITO * added a test for #order_with_common_names * modified list to allow for matching common names to orders * tests for new versions of Faker::Creature::Bird #order_with_common_names and #common_name accepts a parameter for the order to restrict on * added tests to make sure that Faker::Creature::Bird #common_name and #order_with_common_names work properly * corrected Faker::Creature::Bird #order_with_common_name and made #common_name more robust when passed a bad parameter * changed @faker.version to correct next version * corrected rubocop offenses * updated documentation * added additional silly - management apologizes for the insufficient irreverance of previous birb offerings * Fix typo in documentation doc/creature/bird.md Co-authored-by: Koichi ITO Co-authored-by: Koichi ITO --- README.md | 1 + doc/creature/bird.md | 42 + lib/faker/creature/bird.rb | 203 ++++ lib/locales/en/bird.yml | 1281 ++++++++++++++++++++++++ test/faker/creature/test_faker_bird.rb | 93 ++ 5 files changed, 1620 insertions(+) create mode 100644 doc/creature/bird.md create mode 100644 lib/faker/creature/bird.rb create mode 100644 lib/locales/en/bird.yml create mode 100644 test/faker/creature/test_faker_bird.rb diff --git a/README.md b/README.md index 14ffb34750..356e4cf0d3 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast ### Creature - [Faker::Creature::Animal](doc/creature/animal.md) + - [Faker::Creature::Bird](doc/creature/bird.md) - [Faker::Creature::Cat](doc/creature/cat.md) - [Faker::Creature::Dog](doc/creature/dog.md) - [Faker::Creature::Horse](doc/creature/horse.md) diff --git a/doc/creature/bird.md b/doc/creature/bird.md new file mode 100644 index 0000000000..318fb9eca4 --- /dev/null +++ b/doc/creature/bird.md @@ -0,0 +1,42 @@ +# Faker::Creature::Bird + +```ruby +# Random common family name of a bird +Faker::Creature::Bird.common_family_name #=> "Owls" + +# Random taxonomic order from the class Aves (ie. those are birds) +Faker::Creature::Bird.order #=> "Passeriformes" # Fun fact, 60% of birds are Passeriformes! + +# Random bird anatomy word +Faker::Creature::Bird.anatomy #=> "rump" + +# Random bird anatomy word, in the past tense +Faker::Creature::Bird.anatomy_past_tense #=> "breasted" + +# Random bird geography word +Faker::Creature::Bird.geo #=> "Eurasian" + +# Random bird color word +Faker::Creature::Bird.color #=> "ferruginous" + +# Random bird adjective word +Faker::Creature::Bird.adjective #=> "common" + +# Random emotional adjective NOT typically used in bird names +Faker::Creature::Bird.emotional_adjective #=> "cantankerous" + +# Random silly adjective NOT used in bird names +Faker::Creature::Bird.silly_adjective #=> "drunk" + +# Random common name for a bird +Faker::Creature::Bird.common_name #=> 'wren' + +# Random plausible common name for a bird +Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren' + +# Random implausible common name for a bird +Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee' + +# Returns a random pair order / common name pair +Faker::Creature::Bird.order_with_common_name #=> {:order=>"Coliiformes", :common_name=>"Mousebird"} +``` diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb new file mode 100644 index 0000000000..d1a016d1ea --- /dev/null +++ b/lib/faker/creature/bird.rb @@ -0,0 +1,203 @@ +# frozen_string_literal: true + +module Faker + class Creature + class Bird < Base + flexible :bird + + class << self + ## + # Produces a random common family name of a bird. + # + # @return [String] + # + # @example + # Faker::Creature::Bird.common_family_name #=> "Owls" + # + # @faker.version next + def common_family_name + fetch('creature.bird.common_family_name') + end + + ## + # Produces a random common taxonomic order from the class Aves + # + # @return [String] + # + # @example + # Faker::Creature::Bird.order #=> "Passeriformes" + # + # @faker.version next + def order + orders = I18n.translate('faker.creature.bird.order_common_map').keys + sample(orders).to_s + end + + ## + # Produces a random bird anatomy word + # + # @return [String] + # + # @example + # Faker::Creature::Bird.anatomy #=> "rump" + # + # @faker.version next + def anatomy + fetch('creature.bird.anatomy') + end + + ## + # Produces a random, past tensed bird anatomy word + # + # @return [String] + # + # @example + # Faker::Creature::Bird.anatomy #=> "breasted" + # + # @faker.version next + def anatomy_past_tense + fetch('creature.bird.anatomy_past_tense') + end + + ## + # Produces a random geographical word used in describing birds + # + # @return [String] + # + # @example + # Faker::Creature::Bird.geo #=> "Eurasian" + # + # @faker.version next + def geo + fetch('creature.bird.geo') + end + + ## + # Produces a random color word used in describing birds + # + # @return [String] + # + # @example + # Faker::Creature::Bird.color #=> "ferruginous" + # + # @faker.version next + def color + fetch('creature.bird.colors') + end + + ## + # Produces a random adjective used to described birds + # + # @return [String] + # + # @example + # Faker::Creature::Bird.adjective #=> 'common' + # + # @faker.version next + def adjective + fetch('creature.bird.adjectives') + end + + ## + # Produces a random emotional adjective NOT used to described birds + # ...but could be + # + # @return [String] + # + # @example + # Faker::Creature::Bird.emotional_adjective #=> 'cantankerous' + # + # @faker.version next + def emotional_adjective + fetch('creature.bird.emotional_adjectives') + end + + ## + # Produces a random adjective NOT used to described birds + # ...but probably shouldn't + # + # @return [String] + # + # @example + # Faker::Creature::Bird.silly_adjective #=> 'drunk' + # + # @faker.version next + def silly_adjective + fetch('creature.bird.silly_adjectives') + end + + ## + # Produces a random common name for a bird + # + # @param [String | Symbol | nil] tax_order Tax + # @return [String] + # @raises TypeError If `tax_order` cannot be converted into a Symbol + # @raises ArgumentError If `tax_order` is not a valid taxonomic order + # + # @example + # Faker::Creature::Bird.common_name #=> 'wren' + # + # @faker.version next + def common_name(tax_order = nil) + map = translate('faker.creature.bird.order_common_map') + if tax_order.nil? + sample(map.values.flatten).downcase + else + raise TypeError, 'tax_order parameter must be symbolizable' \ + unless tax_order.respond_to?(:to_sym) + raise ArgumentError, "#{tax_order} is not a valid taxonomic order" \ + unless map.keys.include?(tax_order.to_sym) + + the_order = translate('faker.creature.bird.order_common_map')[tax_order.to_sym] + sample(the_order).downcase + end + end + + ## + # Produces a random and plausible common name for a bird + # + # @return [String] + # + # @example + # Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren' + # + # @faker.version next + def plausible_common_name + parse('creature.bird.plausible_common_names').capitalize + end + + ## + # Produces a random and IMplausible common name for a bird + # + # @return [String] + # + # @example + # Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee' + # + # @faker.version next + def implausible_common_name + parse('creature.bird.implausible_common_names').capitalize + end + + ## + # Produces a hash entry with a random order and a random common name + # that is of that order + # + # @return [Hash] + # + # @example + # Faker::Creature::Bird.order_with_common_name #=> { + # order: ''Accipitriformes', + # common_name: 'Osprey' + # } + # + # @faker.version next + def order_with_common_name(tax_order = nil) + map = I18n.translate('faker.creature.bird.order_common_map') + o = tax_order.nil? ? order : tax_order + { order: o, common_name: sample(map[o.to_sym]) } + end + end + end + end +end diff --git a/lib/locales/en/bird.yml b/lib/locales/en/bird.yml new file mode 100644 index 0000000000..96fdb4f508 --- /dev/null +++ b/lib/locales/en/bird.yml @@ -0,0 +1,1281 @@ +--- +en: + faker: + creature: + bird: + order_common_map: + Accipitriformes: + - Bateleur + - Baza + - Besra + - Buzzard + - Eagle + - Goshawk + - Griffon + - Harrier + - Hawk + - Kite + - Osprey + - Secretarybird + - Shikra + - Sparrowhawk + - Vulture + Anseriformes: + - Brant + - Bufflehead + - Canvasback + - Duck + - Eider + - Gadwall + - Garganey + - Goldeneye + - Goose + - Hardhead + - Mallard + - Merganser + - Pintail + - Pochard + - Redhead + - Scaup + - Scoter + - Screamer + - Shelduck + - Shoveler + - Smew + - Swan + - Teal + - Wigeon + Apterygiformes: + - Kiwi + Bucerotiformes: + - Hoopoe + - Hornbill + - Scimitarbill + - Woodhoopoe + Caprimulgiformes: + - Avocetbill + - Awlbill + - Barbthroat + - Blossomcrown + - Brilliant + - Carib + - Comet + - Coquette + - Coronet + - Daggerbill + - Emerald + - Fairy + - Firecrown + - Frogmouth + - Goldentail + - Goldenthroat + - Helmetcrest + - Hermit + - Hillstar + - Hummingbird + - Inca + - Jacobin + - Jewelfront + - Lancebill + - Mango + - Metaltail + - Mountaineer + - Needletail + - Nighthawk + - Nightjar + - Oilbird + - Pauraque + - Piedtail + - Plovercrest + - Plumeleteer + - Poorwill + - Potoo + - Puffleg + - Ruby + - Sabrewing + - Sapphire + - Sapphirewing + - Sheartail + - Sicklebill + - Snowcap + - Spatuletail + - Spinetail + - Starfrontlet + - Starthroat + - Streamertail + - Sunangel + - Sunbeam + - Sungem + - Swift + - Swiftlet + - Sylph + - Thornbill + - Thorntail + - Topaz + - Trainbearer + - Treeswift + - Velvetbreast + - Violetear + - Visorbearer + - Whitetip + - Woodnymph + - Woodstar + Cariamiformes: + - Seriema + Casuariiformes: + - Cassowary + - Emu + Cathartiformes: + - Condor + - Vulture + Charadriiformes: + - Auk + - Auklet + - Avocet + - Buttonquail + - Courser + - Curlew + - Dotterel + - Dovekie + - Dowitcher + - Dunlin + - Godwit + - Greenshank + - Guillemot + - Gull + - Ibisbill + - Jacana + - Jaeger + - Killdeer + - Kittiwake + - Knot + - Lapwing + - Murre + - Murrelet + - Noddy + - Oystercatcher + - Phalarope + - Plover + - Pratincole + - Puffin + - Razorbill + - Redshank + - Ruff + - Sanderling + - Sandpiper + - Seedsnipe + - Sheathbill + - Skimmer + - Skua + - Snipe + - Stilt + - Stint + - Surfbird + - Tattler + - Tern + - Turnstone + - Whimbrel + - Willet + - Woodcock + - Wrybill + - Yellowlegs + Ciconiiformes: + - Adjutant + - Jabiru + - Openbill + - Stork + Coliiformes: + - Mousebird + Columbiformes: + - Bronzewing + - Dodo + - Dove + - Pigeon + - Solitaire + Coraciiformes: + - Dollarbird + - Kingfisher + - Kookaburra + - Motmot + - Roller + - Tody + Cuculiformes: + - Ani + - Coua + - Coucal + - Cuckoo + - Koel + - Malkoha + - Roadrunner + Eurypygiformes: + - Kagu + - Sunbittern + Falconiformes: + - Caracara + - Falcon + - Falconet + - Gyrfalcon + - Hobby + - Kestrel + - Merlin + Galbuliformes: + - Jacamar + - Monklet + - Nunbird + - Nunlet + - Puffbird + Galliformes: + - Argus + - Bobwhite + - Brushturkey + - Capercaillie + - Chachalaca + - Chukar + - Curassow + - Fireback + - Francolin + - Grouse + - Guan + - Guineafowl + - Junglefowl + - Maleo + - Malleefowl + - Monal + - Partridge + - Peacock + - Peafowl + - Pheasant + - Ptarmigan + - Quail + - Scrubfowl + - Snowcock + - Spurfowl + - Tragopan + - Turkey + Gaviiformes: + - Loon + Gruiformes: + - Brolga + - Coot + - Crake + - Crane + - Finfoot + - Flufftail + - Gallinule + - Limpkin + - Moorhen + - Nativehen + - Rail + - Sora + - Sungrebe + - Swamphen + - Takahe + - Trumpeter + - Watercock + - Waterhen + - Weka + Mesitornithiformes: + - Mesite + Musophagiformes: + - Turaco + Opisthocomiformes: + - Hoatzin + Otidiformes: + - Bustard + - Florican + Passeriformes: + - Accentor + - Akalat + - Akekee + - Akepa + - Akialoa + - Akiapolaau + - Akikiki + - Akohekohe + - Alauahio + - Alethe + - Amakihi + - Amaui + - Anianiau + - Antbird + - Antpecker + - Antpipit + - Antpitta + - Antshrike + - Antthrush + - Antvireo + - Antwren + - Apalis + - Apapane + - Apostlebird + - Asity + - Astrapia + - Attila + - Avadavat + - Babax + - Babbler + - Balicassiao + - Bamboowren + - Bananaquit + - Barbtail + - Barwing + - Batis + - Baywing + - Becard + - Bellbird + - Bentbill + - Bernieria + - Berryeater + - Berryhunter + - Berrypecker + - Bishop + - Blackbird + - Blackcap + - Blackstart + - Blackthroat + - Bluebill + - Bluebird + - Bluetail + - Bluethroat + - Boatbill + - Bobolink + - Bokmakierie + - Boubou + - Bowerbird + - Brambling + - Bristlebill + - Bristlebird + - Bristlefront + - Bristlehead + - Broadbill + - Brownbul + - Brubru + - Brushfinch + - Brushrunner + - Bulbul + - Bullfinch + - Bunting + - Bushbird + - Bushchat + - Bushlark + - Bushshrike + - Bushtit + - Butcherbird + - Cacholote + - Cacique + - Calyptura + - Camaroptera + - Canary + - Canastero + - Capuchinbird + - Cardinal + - Casiornis + - Catbird + - Chaffinch + - Chat + - Chatterer + - Chickadee + - Chiffchaff + - Chilia + - Chlorophonia + - Chlorospingus + - Chough + - Chowchilla + - Cicadabird + - Cinclodes + - Cisticola + - Citril + - Cochoa + - Coleto + - Conebill + - Cordonbleu + - Cotinga + - Cowbird + - Creeper + - Crescentchest + - Crimsonwing + - Crocias + - Crombec + - Crossbill + - Crow + - Cuckooshrike + - Cupwing + - Currawong + - Cutia + - Dacnis + - Dickcissel + - Dipper + - Diucon + - Donacobius + - Doradito + - Drongo + - Dunnock + - Earthcreeper + - Elachura + - Elaenia + - Elepaio + - Emutail + - Emuwren + - Eremomela + - Erpornis + - Euphonia + - Fairywren + - Fantail + - Fernbird + - Fernwren + - Fieldfare + - Fieldwren + - Figbird + - Finch + - Finchbill + - Firecrest + - Firefinch + - Firetail + - Firethroat + - Fiscal + - Flamecrest + - Flatbill + - Flowerpecker + - Flowerpiercer + - Flycatcher + - Flyrobin + - Fody + - Forktail + - Friarbird + - Fruitcrow + - Fruiteater + - Fulvetta + - Gallito + - Geomalia + - Gerygone + - Gnatcatcher + - Gnateater + - Gnatwren + - Goldcrest + - Goldenface + - Goldfinch + - Gonolek + - Grackle + - Grandala + - Grassbird + - Grassquit + - Grasswren + - Graveteiro + - Graytail + - Greenbul + - Greenfinch + - Greenlet + - Grenadier + - Grosbeak + - Groundcreeper + - Hawfinch + - Heathwren + - Helmetshrike + - Hemispingus + - Honeycreeper + - Honeyeater + - Hookbill + - Hornero + - Huia + - Hwamei + - Hylia + - Hyliota + - Hylocitrea + - Hypocolius + - Ibon + - Ifrita + - Iiwi + - Illadopsis + - Indigobird + - Iora + - Jackdaw + - Jay + - Jery + - Junco + - Kakawahie + - Kamao + - Kingbird + - Kinglet + - Kioea + - Kiskadee + - Kokako + - Lark + - Laughingthrush + - Leafbird + - Leaftosser + - Leiothrix + - Linnet + - Liocichla + - Locustfinch + - Logrunner + - Longbill + - Longclaw + - Longspur + - Longtail + - Lophorina + - Lyrebird + - Madanga + - Magpie + - Malia + - Malimbe + - Mamo + - Manakin + - Mannikin + - Manucode + - Mao + - Marshbird + - Martin + - Meadowlark + - Melampitta + - Melidectes + - Meliphaga + - Mesia + - Millerbird + - Miner + - Minivet + - Minla + - Mistletoebird + - Mockingbird + - Monarch + - Monjita + - Morningbird + - Mourner + - Munia + - Myna + - Myza + - Myzomela + - Myzornis + - Negrito + - Newtonia + - Nicator + - Nightingale + - Nigrita + - Niltava + - Nukupuu + - Nutcracker + - Nuthatch + - Odedi + - Oliveback + - Olomao + - Omao + - Oo + - Orangequit + - Oriole + - Oropendola + - Ou + - Ouzel + - Ovenbird + - Oxpecker + - Oxylabes + - Palila + - Palmchat + - Palmcreeper + - Paradigalla + - Pardalote + - Pardusco + - Parisoma + - Parotia + - Parrotbill + - Parrotfinch + - Parula + - Peltops + - Peppershrike + - Pewee + - Phainopepla + - Philentoma + - Phoebe + - Piapiac + - Piha + - Pilotbird + - Pinktail + - Piopio + - Pipipi + - Pipit + - Piprites + - Pitohui + - Pitta + - Plantcutter + - Ploughbill + - Plushcap + - Plushcrown + - Prickletail + - Prinia + - Puaiohi + - Puffback + - Purpletuft + - Pyrrhuloxia + - Pytilia + - Quailfinch + - Quelea + - Raven + - Rayadito + - Recurvebill + - Redpoll + - Redstart + - Redthroat + - Redwing + - Reedhaunter + - Reedling + - Rhabdornis + - Riflebird + - Rifleman + - Robin + - Rockfinch + - Rockfowl + - Rockjumper + - Rockrunner + - Rockwarbler + - Rook + - Rosefinch + - Rubythroat + - Rushbird + - Saddleback + - Saltator + - Sapayoa + - Satinbird + - Sawwing + - Schiffornis + - Scrubtit + - Scrubwren + - Scythebill + - Seedcracker + - Seedeater + - Serin + - Shama + - Sharpbill + - Sholakili + - Shortwing + - Shrike + - Shrikebill + - Shrikejay + - Shrikethrush + - Sibia + - Sicklebill + - Silktail + - Silverbill + - Silverbird + - Silvereye + - Sirystes + - Siskin + - Sittella + - Skylark + - Snowfinch + - Softtail + - Solitaire + - Songlark + - Spadebill + - Sparrow + - Speirops + - Spiderhunter + - Spindalis + - Spinebill + - Spinetail + - Spinifexbird + - Starling + - Stipplethroat + - Stitchbird + - Stonechat + - Straightbill + - Streamcreeper + - Stubtail + - Sugarbird + - Sunbird + - Swallow + - Tachuri + - Tailorbird + - Tanager + - Tapaculo + - Tchagra + - Tesia + - Tetraka + - Thamnornis + - Thicketbird + - Thistletail + - Thornbill + - Thornbird + - Thrasher + - Thrush + - Tit + - Titmouse + - Tityra + - Tomtit + - Towhee + - Treecreeper + - Treehunter + - Treepie + - Treerunner + - Trembler + - Triller + - Troupial + - Tuftedcheek + - Tui + - Turca + - Twinspot + - Twistwing + - Twite + - Tyrannulet + - Tyrant + - Umbrellabird + - Vanga + - Veery + - Verdin + - Vireo + - Wagtail + - Wallcreeper + - Warbler + - Waterthrush + - Wattlebird + - Waxbill + - Waxwing + - Weaver + - Wedgebill + - Weebill + - Wheatear + - Whinchat + - Whipbird + - Whistler + - Whiteface + - Whitehead + - Whitethroat + - Whydah + - Widowbird + - Wiretail + - Woodcreeper + - Woodhaunter + - Woodshrike + - Woodswallow + - Wren + - Wrenthrush + - Wrentit + - Xenops + - Xenopsaris + - Yellowhammer + - Yellowhead + - Yellowthroat + - Yuhina + Pelecaniformes: + - Bittern + - Egret + - Hamerkop + - Heron + - Ibis + - Pelican + - Shoebill + - Spoonbill + Phaethontiformes: + - Tropicbird + Phoenicopteriformes: + - Flamingo + Piciformes: + - Aracari + - Barbet + - Flameback + - Flicker + - Honeyguide + - Piculet + - Sapsucker + - Tinkerbird + - Toucan + - Toucanet + - Woodpecker + - Wryneck + - Yellownape + Podicipediformes: + - Grebe + Procellariiformes: + - Albatross + - Fulmar + - Petrel + - Prion + - Shearwater + Psittaciformes: + - Bluebonnet + - Budgerigar + - Cockatiel + - Cockatoo + - Corella + - Galah + - Guaiabero + - Kaka + - Kakapo + - Kea + - Lorikeet + - Lory + - Lovebird + - Macaw + - Parakeet + - Parrot + - Parrotlet + - Ringneck + - Rosella + Pterocliformes: + - Sandgrouse + Rheiformes: + - Rhea + Sphenisciformes: + - Penguin + Strigiformes: + - Boobook + - Morepork + - Owl + - Owlet + Struthioniformes: + - Ostrich + Suliformes: + - Anhinga + - Booby + - Cormorant + - Darter + - Frigatebird + - Gannet + - Shag + Tinamiformes: + - Nothura + - Tinamou + Trogoniformes: + - Quetzal + - Trogon + anatomy: + - back + - beak + - belly + - bill + - breast + - cap + - chin + - collar + - crest + - crown + - eye + - face + - head + - neck + - rump + - shoulder + - tail + - throat + - wing + anatomy_past_tense: + - backed + - beaked + - bearded + - bellied + - breasted + - capped + - chinned + - collared + - crested + - crowned + - eared + - eyed + - faced + - fronted + - headed + - hooded + - naped + - necked + - rumped + - shouldered + - tailed + - throated + - winged + geo: + - African + - American + - Arabian + - Arctic + - Asian + - Atlantic + - Australian + - Baltimore + - Brazilian + - California + - Canada + - Carolina + - Chihuahua + - Chinese + - Congo + - Colombian + - eastern + - Egyptian + - Eurasian + - Inca + - Iranian + - Japanese + - Kentucky + - Madagascar + - Mexican + - Mississippi + - Mongolian + - mountain + - New Zeland + - northern + - Pacific + - Papuan + - prarie + - sandhill + - Savannah + - southern + - Spanish + - swamp + - tropical + - western + colors: + - ash + - black + - blue + - bronze + - brown + - cerulean + - chestnut + - dusky + - ferruginous + - fulvous + - gold + - gray + - green + - indigo + - lazuli + - purple + - red + - roze + - roseate + - ruby + - ruddy + - rufous + - smoky + - snooty + - snowy + - tawny + - violet + - white + - yellow + emotional_adjectives: + - angry + - aggrieved + - agitated + - anxious + - cantankerous + - demented + - depressed + - flirty + - furious + - gloomy + - gregarious + - irritated + - lonely + - manic + - moody + - morbid + - murderous + - needy + - nervous + - ornery + - panicked + - quizzical + - sad + - sleepy + - terrified + silly_adjectives: + - anarchist + - bloated + - communist + - conservative + - dangerous + - drunk + - dumb + - enchanted + - flatulent + - idiotic + - impotent + - incompotent + - insufferable + - liberal + - Masonic + - noxious + - obnoxious + - pansexual + - racist + - sexist + - silly + - vegan + adjectives: + - banded + - common + - dwarf + - giant + - great + - greater + - lesser + - lined + - painted + - rough + - smooth + - spotted + plausible_common_names: + - "#{Name.last_name}'s #{common_name}" + - "#{adjective} #{anatomy} #{common_name}" + - "#{adjective}-#{anatomy_past_tense} #{common_name}" + - "#{color}-#{anatomy_past_tense} #{common_name}" + - "#{adjective} #{common_name}" + - "#{geo} #{common_name}" + - "#{geo} #{color} #{common_name}" + implausible_common_names: + - "#{Name.last_name}'s #{emotional_adjective} #{common_name}" + - "#{Name.last_name}'s #{silly_adjective} #{common_name}" + - "#{adjective} #{silly_adjective} #{common_name}" + - "#{adjective} #{emotional_adjective} #{common_name}" + - "#{geo} #{silly_adjective} #{common_name}" + - "#{geo} #{emotional_adjective} #{common_name}" + - "#{color}-#{anatomy_past_tense} #{silly_adjective} #{common_name}" + - "#{color}-#{anatomy_past_tense} #{emotional_adjective} #{common_name}" + common_family_name: + - Accentors + - African Barbets + - African Warblers + - African and Green Broadbills + - Albatrosses + - Anhingas + - Antpittas + - Antthrushes + - Asian Barbets + - Asian and Grauer's Broadbills + - Asities + - Auks, Murres, and Puffins + - Australasian Robins + - Australasian Treecreepers + - Australo-Papuan Bellbirds + - Barn-Owls + - Bearded Reedling + - Bee-eaters + - Berrypeckers and Longbills + - Birds-of-Paradise + - Boatbills + - Boobies and Gannets + - Bowerbirds + - Bristlebirds + - Bristlehead + - Bulbuls + - Bush Warblers and Allies + - Bushshrikes and Allies + - Bustards + - Buttonquail + - Cardinals and Allies + - Cassowaries and Emu + - Chat-Tanagers + - Cisticolas and Allies + - Cockatoos + - Cormorants and Shags + - Cotingas + - Crab-Plover + - Cranes + - Crescentchests + - Crested Shrikejay + - Crows, Jays, and Magpies + - Cuban Warblers + - Cuckoo-roller + - Cuckoos + - Cuckooshrikes + - Cupwings + - Dapple-throat and Allies + - Dippers + - Donacobius + - Drongos + - Ducks, Geese, and Waterfowl + - Egyptian Plover + - Fairy Flycatchers + - Fairy-bluebirds + - Fairywrens + - Falcons and Caracaras + - Fantails + - Finches, Euphonias, and Allies + - Finfoots + - Flamingos + - Flowerpeckers + - Flufftails + - Frigatebirds + - Frogmouths + - Gnatcatchers + - Gnateaters + - Grassbirds and Allies + - Grebes + - Ground Babblers and Allies + - Ground-Hornbills + - Ground-Rollers + - Guans, Chachalacas, and Curassows + - Guineafowl + - Gulls, Terns, and Skimmers + - Hamerkop + - Hawaiian Honeyeaters + - Hawks, Eagles, and Kites + - Herons, Egrets, and Bitterns + - Hispaniolan Tanagers + - Hoatzin + - Honeyeaters + - Honeyguides + - Hoopoes + - Hornbills + - Hummingbirds + - Hyliotas + - Hylocitrea + - Hypocolius + - Ibisbill + - Ibises and Spoonbills + - Ifrita + - Indigobirds + - Ioras + - Jacamars + - Jacanas + - Kagu + - Kingfishers + - Kinglets + - Kiwis + - Larks + - Laughingthrushes and Allies + - Leaf Warblers + - Leafbirds + - Limpkin + - Logrunners + - Long-tailed Tits + - Longspurs and Snow Buntings + - Loons + - Lyrebirds + - Magellanic Plover + - Magpie Goose + - Malagasy Warblers + - Manakins + - Megapodes + - Melampittas + - Mesites + - Mitrospingid Tanagers + - Mockingbirds and Thrashers + - Monarch Flycatchers + - Motmots + - Mottled Berryhunter + - Mousebirds + - New World Barbets + - New World Quail + - New World Sparrows + - New World Vultures + - New World Warblers + - New World and African Parrots + - New Zealand Parrots + - New Zealand Wrens + - Nicators + - Nightjars and Allies + - Northern Storm-Petrels + - Nuthatches + - Oilbird + - Old World Buntings + - Old World Flycatchers + - Old World Orioles + - Old World Parrots + - Old World Sparrows + - Olive Warbler + - Osprey + - Ostriches + - Ovenbirds and Woodcreepers + - Owlet-nightjars + - Owls + - Oxpeckers + - Oystercatchers + - Painted-Snipes + - Palmchat + - Pardalotes + - Pelicans + - Penduline-Tits + - Penguins + - Pheasants, Grouse, and Allies + - Pigeons and Doves + - Pittas + - Plains-wanderer + - Ploughbill + - Plovers and Lapwings + - Potoos + - Pratincoles and Coursers + - Przevalski's Pinktail + - Pseudo-Babblers + - Puerto Rican Tanager + - Puffbirds + - Quail-thrushes and Jewel-babblers + - Rail-babbler + - Rails, Gallinules, and Coots + - Reed Warblers and Allies + - Rheas + - Rockfowl + - Rockjumpers + - Rollers + - Sandgrouse + - Sandpipers and Allies + - Sapayoa + - Satinbirds + - Screamers + - Scrub-birds + - Secretarybird + - Seedsnipes + - Seriemas + - Sharpbill, Royal Flycatcher, and Allies + - Shearwaters and Petrels + - Sheathbills + - Shoebill + - Shrike-tit + - Shrikes + - Silky-flycatchers + - Sittellas + - Skuas and Jaegers + - Southern Storm-Petrels + - Spindalises + - Spotted Elachura + - Starlings + - Stilts and Avocets + - Stitchbird + - Storks + - Sugarbirds + - Sunbirds and Spiderhunters + - Sunbittern + - Swallows + - Swifts + - Sylviid Warblers, Parrotbills, and Allies + - Tanagers and Allies + - Tapaculos + - Thick-knees + - Thornbills and Allies + - Thrush-Tanager + - Thrushes and Allies + - Tinamous + - Tit Berrypecker and Crested Berrypecker + - Tits, Chickadees, and Titmice + - Tityras and Allies + - Todies + - Toucan-Barbets + - Toucans + - Tree-Babblers, Scimitar-Babblers, and Allies + - Treecreepers + - Treeswifts + - Trogons + - Tropicbirds + - Troupials and Allies + - Trumpeters + - Turacos + - Typical Antbirds + - Tyrant Flycatchers + - Vangas, Helmetshrikes, and Allies + - Vireos, Shrike-Babblers, and Erpornis + - Wagtails and Pipits + - Wallcreeper + - Wattle-eyes and Batises + - Wattlebirds + - Waxbills and Allies + - Waxwings + - Weavers and Allies + - Whipbirds and Wedgebills + - Whistlers and Allies + - White-eyes, Yuhinas, and Allies + - White-winged Chough and Apostlebird + - Whiteheads + - Woodhoopoes and Scimitarbills + - Woodpeckers + - Woodswallows, Bellmagpies, and Allies + - Wrens + - Wrenthrush + - Yellow-breasted Chat diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb new file mode 100644 index 0000000000..88800d041d --- /dev/null +++ b/test/faker/creature/test_faker_bird.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +require_relative '../../test_helper' + +class TestFakerCreatureBird < Test::Unit::TestCase + def setup + @tester = Faker::Creature::Bird + @common_order_map = I18n.translate('faker.creature.bird.order_common_map') + end + + def test_orders + assert @tester.order.match(/[A-Z]\w+formes/) + end + + def test_anatomies + assert @tester.anatomy.match(/[a-z]+/) + end + + def test_anatomy_past_tenses + assert @tester.anatomy_past_tense.match(/[a-z]+ed$/) + end + + def test_geos + assert @tester.geo.match(/[A-Za-z][a-z ]/) + end + + def test_colors + assert @tester.color.match(/[a-z]+/) + end + + def test_silly_adjectives + assert @tester.emotional_adjective.match(/[a-z]+/) && @tester.silly_adjective.match(/[a-z]+/) + end + + def test_adjectives + assert @tester.adjective.match(/[a-z]+/) + end + + def test_common_names + assert @tester.common_name.match(/[a-z]+/) + end + + def test_common_names_with_specific_order + specific_order = @tester.order + name = @tester.common_name specific_order + assert_includes @common_order_map[specific_order.to_sym].map(&:downcase), name + end + + def test_common_names_with_specific_but_imaginary_order + not_real_order = :Somethingaformes + assert_raises(ArgumentError) { @tester.common_name not_real_order } + end + + def test_common_name_with_bad_parameter + stupid_param = 9 + assert_raises(TypeError) { @tester.common_name stupid_param } + end + + def test_order_with_common_names + entry = @tester.order_with_common_name + assert_includes(@common_order_map.keys, entry[:order].to_sym) && \ + assert_includes(@common_order_map[entry[:order]], entry[:common_name]) + end + + def test_specific_order_with_common_names + specific_order = @tester.order + entry = @tester.order_with_common_name specific_order + assert_includes(@common_order_map[specific_order.to_sym], entry[:common_name]) + end + + def test_plausible_common_names + patterns = [ + /[A-Z][a-z]+'s [a-z]+/, + /[A-Z][a-z]+ [a-z]+/, + /[A-Z][a-z]+ [a-z]+ [a-z]+/, + /[A-Z][a-z]+-[a-z]+ed [a-z]+/ + ] + name = @tester.plausible_common_name + assert patterns.collect { |pattern| pattern.match? name }.any?, + "Faker::Creature::Bird#plausible_common_name failed on '#{name}'" + end + + def test_implausable_common_names + patterns = [ + /[A-Z][a-z]+'s [a-z]+ [a-z]+/, + /[A-Z][a-z]+ [a-z]+ [a-z]+/, + /[A-Z][a-z]+-[a-z]+ed [a-z]+ [a-z]+/ + ] + name = @tester.implausible_common_name + assert patterns.collect { |pattern| pattern.match? name }.any?, + "Faker::Creature::Bird#implausible_common_name failed on '#{name}'" + end +end From 1fb90766b881b89a05dc3d8df2ce2d7c8163f925 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 22 Apr 2021 07:02:43 -0700 Subject: [PATCH 3/4] Update rubocop requirement from = 1.12.1 to = 1.13.0 (#2305) Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.12.1...v1.13.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Gemfile.lock | 8 ++++---- faker.gemspec | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e67fd8c4d7..81dc1383a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,7 +17,7 @@ GEM method_source (1.0.0) minitest (5.14.4) parallel (1.20.1) - parser (3.0.0.0) + parser (3.0.1.0) ast (~> 2.4.1) power_assert (2.0.0) pry (0.14.1) @@ -26,8 +26,8 @@ GEM rainbow (3.0.0) rake (13.0.3) regexp_parser (2.1.1) - rexml (3.2.4) - rubocop (1.12.1) + rexml (3.2.5) + rubocop (1.13.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -58,7 +58,7 @@ DEPENDENCIES minitest (= 5.14.4) pry (= 0.14.1) rake (= 13.0.3) - rubocop (= 1.12.1) + rubocop (= 1.13.0) simplecov (= 0.17.1, < 0.18) test-unit (= 3.4.0) timecop (= 0.9.4) diff --git a/faker.gemspec b/faker.gemspec index eb423f9849..bb9dc1d75e 100644 --- a/faker.gemspec +++ b/faker.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency('minitest', '5.14.4') spec.add_development_dependency('pry', '0.14.1') spec.add_development_dependency('rake', '13.0.3') - spec.add_development_dependency('rubocop', '1.12.1') + spec.add_development_dependency('rubocop', '1.13.0') # Workaround for cc-test-reporter with SimpleCov 0.18. # Stop upgrading SimpleCov until the following issue will be resolved. # https://github.com/codeclimate/test-reporter/issues/418 From aa31845ed54c25eb2638d716bfddf59771b502aa Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 22 Apr 2021 07:02:59 -0700 Subject: [PATCH 4/4] Update test-unit requirement from = 3.4.0 to = 3.4.1 (#2303) Updates the requirements on [test-unit](https://github.com/test-unit/test-unit) to permit the latest version. - [Release notes](https://github.com/test-unit/test-unit/releases) - [Commits](https://github.com/test-unit/test-unit/compare/3.4.0...3.4.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- faker.gemspec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 81dc1383a6..602bf8ef1f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,7 +44,7 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - test-unit (3.4.0) + test-unit (3.4.1) power_assert timecop (0.9.4) unicode-display_width (2.0.0) @@ -60,7 +60,7 @@ DEPENDENCIES rake (= 13.0.3) rubocop (= 1.13.0) simplecov (= 0.17.1, < 0.18) - test-unit (= 3.4.0) + test-unit (= 3.4.1) timecop (= 0.9.4) yard (= 0.9.26) diff --git a/faker.gemspec b/faker.gemspec index bb9dc1d75e..c9837534a2 100644 --- a/faker.gemspec +++ b/faker.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |spec| # Stop upgrading SimpleCov until the following issue will be resolved. # https://github.com/codeclimate/test-reporter/issues/418 spec.add_development_dependency('simplecov', '0.17.1', '< 0.18') - spec.add_development_dependency('test-unit', '3.4.0') + spec.add_development_dependency('test-unit', '3.4.1') spec.add_development_dependency('timecop', '0.9.4') spec.add_development_dependency('yard', '0.9.26') end