From 5449ac5add77e148f96e1d3c248efd1ac1978415 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 11 Apr 2021 16:31:03 -0400 Subject: [PATCH 01/19] added tests for all simple bird look-ups --- test/faker/creature/test_faker_bird.rb | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/faker/creature/test_faker_bird.rb diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb new file mode 100644 index 0000000000..48bc6b3fb2 --- /dev/null +++ b/test/faker/creature/test_faker_bird.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +require_relative '../../test_helper' + +class TestFakerCreatureBird < Test::Unit::TestCase + def setup + @tester = Faker::Creature::Bird + end + + def test_order + assert @tester.order.match(/[A-Z]\w+formes/) + end + + def test_anatomy + assert @tester.anatomy.match(/[a-z]+/) + end + + def test_anatomy_past_tense + assert @tester.anatomy_past_tense.match(/[a-z]+ed$/) + end + + def test_geo + assert @tester.geo.match(/[A-Za-z][a-z ]/) + end + + def test_color + 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_adjective + assert @tester.adjective.match(/[a-z]+/) + end + + def test_common_name + assert @tester.common_name.match(/[A-Z][a-z]+/) + end +end From d3960a7a46ff0b9490af81bc769cbff3aae7952f Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 11 Apr 2021 16:32:15 -0400 Subject: [PATCH 02/19] added bird words (bird is the word) --- lib/locales/en/bird.yml | 1245 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 1245 insertions(+) create mode 100644 lib/locales/en/bird.yml diff --git a/lib/locales/en/bird.yml b/lib/locales/en/bird.yml new file mode 100644 index 0000000000..120496b2aa --- /dev/null +++ b/lib/locales/en/bird.yml @@ -0,0 +1,1245 @@ +--- +en: + faker: + creature: + bird: + order: + - Accipitriformes + - Anseriformes + - Apterygiformes + - Bucerotiformes + - Caprimulgiformes + - Cariamiformes + - Casuariiformes + - Cathartiformes + - Charadriiformes + - Ciconiiformes + - Coliiformes + - Columbiformes + - Coraciiformes + - Cuculiformes + - Eurypygiformes + - Falconiformes + - Galbuliformes + - Galliformes + - Gaviiformes + - Gruiformes + - Leptosomiformes + - Mesitornithiformes + - Musophagiformes + - Opisthocomiformes + - Otidiformes + - Passeriformes + - Pelecaniformes + - Phaethontiformes + - Phoenicopteriformes + - Piciformes + - Podicipediformes + - Procellariiformes + - Psittaciformes + - Pterocliformes + - Rheiformes + - Sphenisciformes + - Strigiformes + - Struthioniformes + - Suliformes + - Tinamiformes + - Trogoniformes + 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: + - bloated + - dangerous + - drunk + - dumb + - enchanted + - silly + adjectives: + - banded + - common + - dwarf + - giant + - great + - greater + - lesser + - lined + - painted + - rough + - smooth + - spotted + common_names: + - Accentor + - Adjutant + - Akalat + - Akekee + - Akepa + - Akialoa + - Akiapolaau + - Akikiki + - Akohekohe + - Alauahio + - Albatross + - Alethe + - Amakihi + - Amaui + - Anhinga + - Ani + - Anianiau + - Antbird + - Antpecker + - Antpipit + - Antpitta + - Antshrike + - Antthrush + - Antvireo + - Antwren + - Apalis + - Apapane + - Apostlebird + - Aracari + - Argus + - Asity + - Astrapia + - Attila + - Auk + - Auklet + - Avadavat + - Avocet + - Avocetbill + - Awlbill + - Babax + - Babbler + - Balicassiao + - Bamboowren + - Bananaquit + - Barbet + - Barbtail + - Barbthroat + - Barwing + - Bateleur + - Batis + - Baywing + - Baza + - Becard + - Bellbird + - Bentbill + - Bernieria + - Berryeater + - Berryhunter + - Berrypecker + - Besra + - Bishop + - Bittern + - Blackbird + - Blackcap + - Blackstart + - Blackthroat + - Blossomcrown + - Bluebill + - Bluebird + - Bluebonnet + - Bluetail + - Bluethroat + - Boatbill + - Bobolink + - Bobwhite + - Bokmakierie + - Boobook + - Booby + - Boubou + - Bowerbird + - Brambling + - Brant + - Brilliant + - Bristlebill + - Bristlebird + - Bristlefront + - Bristlehead + - Broadbill + - Brolga + - Bronzewing + - Brownbul + - Brubru + - Brushfinch + - Brushrunner + - Brushturkey + - Budgerigar + - Bufflehead + - Bulbul + - Bullfinch + - Bunting + - Bushbird + - Bushchat + - Bushlark + - Bushshrike + - Bushtit + - Bustard + - Butcherbird + - Buttonquail + - Buzzard + - Cacholote + - Cacique + - Calyptura + - Camaroptera + - Canary + - Canastero + - Canvasback + - Capercaillie + - Capuchinbird + - Caracara + - Cardinal + - Carib + - Casiornis + - Cassowary + - Catbird + - Chachalaca + - Chaffinch + - Chat + - Chatterer + - Chickadee + - Chiffchaff + - Chilia + - Chlorophonia + - Chlorospingus + - Chough + - Chowchilla + - Chukar + - Cicadabird + - Cinclodes + - Cisticola + - Citril + - Cochoa + - Cockatiel + - Cockatoo + - Coleto + - Comet + - Condor + - Conebill + - Coot + - Coquette + - Cordonbleu + - Corella + - Cormorant + - Coronet + - Cotinga + - Coua + - Coucal + - Courser + - Cowbird + - Crake + - Crane + - Creeper + - Crescentchest + - Crimsonwing + - Crocias + - Crombec + - Crossbill + - Crow + - Cuckoo + - Cuckooshrike + - Cupwing + - Curassow + - Curlew + - Currawong + - Cutia + - Dacnis + - Daggerbill + - Darter + - Dickcissel + - Dipper + - Diucon + - Dodo + - Dollarbird + - Donacobius + - Doradito + - Dotterel + - Dove + - Dovekie + - Dowitcher + - Drongo + - Duck + - Dunlin + - Dunnock + - Eagle + - Earthcreeper + - Egret + - Eider + - Elachura + - Elaenia + - Elepaio + - Emerald + - Emu + - Emutail + - Emuwren + - Eremomela + - Erpornis + - Euphonia + - Fairy + - Fairywren + - Falcon + - Falconet + - Fantail + - Fernbird + - Fernwren + - Fieldfare + - Fieldwren + - Figbird + - Finch + - Finchbill + - Finfoot + - Fireback + - Firecrest + - Firecrown + - Firefinch + - Firetail + - Firethroat + - Fiscal + - Flameback + - Flamecrest + - Flamingo + - Flatbill + - Flicker + - Florican + - Flowerpecker + - Flowerpiercer + - Flufftail + - Flycatcher + - Flyrobin + - Fody + - Forktail + - Francolin + - Friarbird + - Frigatebird + - Frogmouth + - Fruitcrow + - Fruiteater + - Fulmar + - Fulvetta + - Gadwall + - Galah + - Gallinule + - Gallito + - Gannet + - Garganey + - Geomalia + - Gerygone + - Gnatcatcher + - Gnateater + - Gnatwren + - Godwit + - Goldcrest + - Goldeneye + - Goldenface + - Goldentail + - Goldenthroat + - Goldfinch + - Gonolek + - Goose + - Goshawk + - Grackle + - Grandala + - Grassbird + - Grassquit + - Grasswren + - Graveteiro + - Graytail + - Grebe + - Greenbul + - Greenfinch + - Greenlet + - Greenshank + - Grenadier + - Griffon + - Grosbeak + - Groundcreeper + - Grouse + - Guaiabero + - Guan + - Guillemot + - Guineafowl + - Gull + - Gyrfalcon + - Hamerkop + - Hardhead + - Harrier + - Hawfinch + - Hawk + - Heathwren + - Helmetcrest + - Helmetshrike + - Hemispingus + - Hermit + - Heron + - Hillstar + - Hoatzin + - Hobby + - Honeycreeper + - Honeyeater + - Honeyguide + - Hookbill + - Hoopoe + - Hornbill + - Hornero + - Huia + - Hummingbird + - Hwamei + - Hylia + - Hyliota + - Hylocitrea + - Hypocolius + - Ibis + - Ibisbill + - Ibon + - Ifrita + - Iiwi + - Illadopsis + - Inca + - Indigobird + - Iora + - Jabiru + - Jacamar + - Jacana + - Jackdaw + - Jacobin + - Jaeger + - Jay + - Jery + - Jewelfront + - Junco + - Junglefowl + - Kagu + - Kaka + - Kakapo + - Kakawahie + - Kamao + - Kea + - Kestrel + - Killdeer + - Kingbird + - Kingfisher + - Kinglet + - Kioea + - Kiskadee + - Kite + - Kittiwake + - Kiwi + - Knot + - Koel + - Kokako + - Kookaburra + - Lancebill + - Lapwing + - Lark + - Laughingthrush + - Leafbird + - Leaftosser + - Leiothrix + - Limpkin + - Linnet + - Liocichla + - Locustfinch + - Logrunner + - Longbill + - Longclaw + - Longspur + - Longtail + - Loon + - Lophorina + - Lorikeet + - Lory + - Lovebird + - Lyrebird + - Macaw + - Madanga + - Magpie + - Maleo + - Malia + - Malimbe + - Malkoha + - Mallard + - Malleefowl + - Mamo + - Manakin + - Mango + - Mannikin + - Manucode + - Mao + - Marshbird + - Martin + - Meadowlark + - Melampitta + - Melidectes + - Meliphaga + - Merganser + - Merlin + - Mesia + - Mesite + - Metaltail + - Millerbird + - Miner + - Minivet + - Minla + - Mistletoebird + - Mockingbird + - Monal + - Monarch + - Monjita + - Monklet + - Moorhen + - Morepork + - Morningbird + - Motmot + - Mountaineer + - Mourner + - Mousebird + - Munia + - Murre + - Murrelet + - Myna + - Myza + - Myzomela + - Myzornis + - Nativehen + - Needletail + - Negrito + - Newtonia + - Nicator + - Nighthawk + - Nightingale + - Nightjar + - Nigrita + - Niltava + - Noddy + - Nothura + - Nukupuu + - Nunbird + - Nunlet + - Nutcracker + - Nuthatch + - Odedi + - Oilbird + - Oliveback + - Olomao + - Omao + - Oo + - Openbill + - Orangequit + - Oriole + - Oropendola + - Osprey + - Ostrich + - Ou + - Ouzel + - Ovenbird + - Owl + - Owlet + - Oxpecker + - Oxylabes + - Oystercatcher + - Palila + - Palmchat + - Palmcreeper + - Paradigalla + - Parakeet + - Pardalote + - Pardusco + - Parisoma + - Parotia + - Parrot + - Parrotbill + - Parrotfinch + - Parrotlet + - Partridge + - Parula + - Pauraque + - Peacock + - Peafowl + - Pelican + - Peltops + - Penguin + - Peppershrike + - Petrel + - Pewee + - Phainopepla + - Phalarope + - Pheasant + - Philentoma + - Phoebe + - Piapiac + - Piculet + - Piedtail + - Pigeon + - Piha + - Pilotbird + - Pinktail + - Pintail + - Piopio + - Pipipi + - Pipit + - Piprites + - Pitohui + - Pitta + - Plantcutter + - Ploughbill + - Plover + - Plovercrest + - Plumeleteer + - Plushcap + - Plushcrown + - Pochard + - Poorwill + - Potoo + - Pratincole + - Prickletail + - Prinia + - Prion + - Ptarmigan + - Puaiohi + - Puffback + - Puffbird + - Puffin + - Puffleg + - Purpletuft + - Pyrrhuloxia + - Pytilia + - Quail + - Quailfinch + - Quelea + - Quetzal + - Rail + - Raven + - Rayadito + - Razorbill + - Recurvebill + - Redhead + - Redpoll + - Redshank + - Redstart + - Redthroat + - Redwing + - Reedhaunter + - Reedling + - Rhabdornis + - Rhea + - Riflebird + - Rifleman + - Ringneck + - Roadrunner + - Robin + - Rockfinch + - Rockfowl + - Rockjumper + - Rockrunner + - Rockwarbler + - Roller + - Rook + - Rosefinch + - Rosella + - Ruby + - Rubythroat + - Ruff + - Rushbird + - Sabrewing + - Saddleback + - Saltator + - Sanderling + - Sandgrouse + - Sandpiper + - Sapayoa + - Sapphire + - Sapphirewing + - Sapsucker + - Satinbird + - Sawwing + - Scaup + - Schiffornis + - Scimitarbill + - Scoter + - Screamer + - Scrubfowl + - Scrubtit + - Scrubwren + - Scythebill + - Secretarybird + - Seedcracker + - Seedeater + - Seedsnipe + - Seriema + - Serin + - Shag + - Shama + - Sharpbill + - Sheartail + - Shearwater + - Sheathbill + - Shelduck + - Shikra + - Shoebill + - Sholakili + - Shortwing + - Shoveler + - Shrike + - Shrikebill + - Shrikejay + - Shrikethrush + - Sibia + - Sicklebill + - Silktail + - Silverbill + - Silverbird + - Silvereye + - Sirystes + - Siskin + - Sittella + - Skimmer + - Skua + - Skylark + - Smew + - Snipe + - Snowcap + - Snowcock + - Snowfinch + - Softtail + - Solitaire + - Songlark + - Sora + - Spadebill + - Sparrow + - Sparrowhawk + - Spatuletail + - Speirops + - Spiderhunter + - Spindalis + - Spinebill + - Spinetail + - Spinifexbird + - Spoonbill + - Spurfowl + - Starfrontlet + - Starling + - Starthroat + - Stilt + - Stint + - Stipplethroat + - Stitchbird + - Stonechat + - Stork + - Straightbill + - Streamcreeper + - Streamertail + - Stubtail + - Sugarbird + - Sunangel + - Sunbeam + - Sunbird + - Sunbittern + - Sungem + - Sungrebe + - Surfbird + - Swallow + - Swamphen + - Swan + - Swift + - Swiftlet + - Sylph + - Tachuri + - Tailorbird + - Takahe + - Tanager + - Tapaculo + - Tattler + - Tchagra + - Teal + - Tern + - Tesia + - Tetraka + - Thamnornis + - Thicketbird + - Thistletail + - Thornbill + - Thornbird + - Thorntail + - Thrasher + - Thrush + - Tinamou + - Tinkerbird + - Tit + - Titmouse + - Tityra + - Tody + - Tomtit + - Topaz + - Toucan + - Toucanet + - Towhee + - Tragopan + - Trainbearer + - Treecreeper + - Treehunter + - Treepie + - Treerunner + - Treeswift + - Trembler + - Triller + - Trogon + - Tropicbird + - Troupial + - Trumpeter + - Tuftedcheek + - Tui + - Turaco + - Turca + - Turkey + - Turnstone + - Twinspot + - Twistwing + - Twite + - Tyrannulet + - Tyrant + - Umbrellabird + - Vanga + - Veery + - Velvetbreast + - Verdin + - Violetear + - Vireo + - Visorbearer + - Vulture + - Wagtail + - Wallcreeper + - Warbler + - Watercock + - Waterhen + - Waterthrush + - Wattlebird + - Waxbill + - Waxwing + - Weaver + - Wedgebill + - Weebill + - Weka + - Wheatear + - Whimbrel + - Whinchat + - Whipbird + - Whistler + - Whiteface + - Whitehead + - Whitethroat + - Whitetip + - Whydah + - Widowbird + - Wigeon + - Willet + - Wiretail + - Woodcock + - Woodcreeper + - Woodhaunter + - Woodhoopoe + - Woodnymph + - Woodpecker + - Woodshrike + - Woodstar + - Woodswallow + - Wren + - Wrenthrush + - Wrentit + - Wrybill + - Wryneck + - Xenops + - Xenopsaris + - Yellowhammer + - Yellowhead + - Yellowlegs + - Yellownape + - Yellowthroat + - Yuhina + 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 From 1a98283c806dcbc22c9a78725bed9bf20ca274d8 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 11 Apr 2021 16:34:31 -0400 Subject: [PATCH 03/19] added birds! --- lib/faker/creature/bird.rb | 143 +++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 lib/faker/creature/bird.rb diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb new file mode 100644 index 0000000000..29c05f57c1 --- /dev/null +++ b/lib/faker/creature/bird.rb @@ -0,0 +1,143 @@ +# 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 2.16.0 + 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 2.16.0 + def order + fetch('creature.bird.order') + end + + ## + # Produces a random bird anatomy word + # + # @return [String] + # + # @example + # Faker::Creature::Bird.anatomy #=> "rump" + # + # @faker.version 2.16.0 + 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 2.16.0 + 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 2.16.0 + 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 2.16.0 + 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 2.16.0 + 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 2.16.0 + 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 2.16.0 + def silly_adjective + fetch('creature.bird.silly_adjectives') + end + + ## + # Produces a random common name for a bird + # + # @return [String] + # + # @example + # Faker::Creature::Bird.common_name #=> 'Wren' + # + # @faker.version 2.16.0 + def common_name + fetch('creature.bird.common_names') + end + end + end + end +end From 51ecf8a317a3ec7c2851e18e34d29299530ae8dc Mon Sep 17 00:00:00 2001 From: brotherjack Date: Mon, 12 Apr 2021 14:26:30 -0400 Subject: [PATCH 04/19] added tests for plausible and implausible common names for birds and correcting tests for adjectives and common_name roots --- test/faker/creature/test_faker_bird.rb | 36 ++++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index 48bc6b3fb2..6491d4de60 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -7,23 +7,23 @@ def setup @tester = Faker::Creature::Bird end - def test_order + def test_orders assert @tester.order.match(/[A-Z]\w+formes/) end - def test_anatomy + def test_anatomies assert @tester.anatomy.match(/[a-z]+/) end - def test_anatomy_past_tense + def test_anatomy_past_tenses assert @tester.anatomy_past_tense.match(/[a-z]+ed$/) end - def test_geo + def test_geos assert @tester.geo.match(/[A-Za-z][a-z ]/) end - def test_color + def test_colors assert @tester.color.match(/[a-z]+/) end @@ -31,11 +31,31 @@ def test_silly_adjectives assert @tester.emotional_adjective.match(/[a-z]+/) && @tester.silly_adjective.match(/[a-z]+/) end - def test_adjective + def test_adjectives assert @tester.adjective.match(/[a-z]+/) end - def test_common_name - assert @tester.common_name.match(/[A-Z][a-z]+/) + def test_common_names + assert @tester.common_name.match(/[a-z]+/) + 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]+ed [a-z]+/ + ] + name = @tester.plausible_common_name + assert patterns.collect { |pattern| pattern.match? name }.any? + 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? end end From 3ae6766780399770f0cc375e99bf2d31930a7fe6 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Mon, 12 Apr 2021 14:29:35 -0400 Subject: [PATCH 05/19] added .plausible_common_name and .implausible_common_name and made .common_name string be lowercase --- lib/faker/creature/bird.rb | 30 ++++++++++++++++++++++++++++-- lib/locales/en/bird.yml | 17 +++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index 29c05f57c1..4bff4864d1 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -131,11 +131,37 @@ def silly_adjective # @return [String] # # @example - # Faker::Creature::Bird.common_name #=> 'Wren' + # Faker::Creature::Bird.common_name #=> 'wren' # # @faker.version 2.16.0 def common_name - fetch('creature.bird.common_names') + fetch('creature.bird.common_names').downcase + 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 2.16.0 + 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.plausible_common_name #=> 'Hellinger's Cantankerous Chickadee' + # + # @faker.version 2.16.0 + def implausible_common_name + parse('creature.bird.implausible_common_names').capitalize end end end diff --git a/lib/locales/en/bird.yml b/lib/locales/en/bird.yml index 120496b2aa..2b17061a23 100644 --- a/lib/locales/en/bird.yml +++ b/lib/locales/en/bird.yml @@ -206,6 +206,23 @@ en: - 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_names: - Accentor - Adjutant From 714368b050d452cb94f1a1cc4ef6e497f38c848a Mon Sep 17 00:00:00 2001 From: brotherjack Date: Tue, 13 Apr 2021 14:02:33 -0400 Subject: [PATCH 06/19] added documentation of bird methods --- doc/creature/bird.md | 39 ++++++++++++++++++++++++++++++++++++++ lib/faker/creature/bird.rb | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 doc/creature/bird.md diff --git a/doc/creature/bird.md b/doc/creature/bird.md new file mode 100644 index 0000000000..d35f9bdbfb --- /dev/null +++ b/doc/creature/bird.md @@ -0,0 +1,39 @@ +# 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 #=> "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' +``` diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index 4bff4864d1..db99cd3837 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -157,7 +157,7 @@ def plausible_common_name # @return [String] # # @example - # Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Cantankerous Chickadee' + # Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee' # # @faker.version 2.16.0 def implausible_common_name From 1dad858c629399887e4c14ebab0969c3f34738b5 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Wed, 14 Apr 2021 13:27:34 -0400 Subject: [PATCH 07/19] corrected Rubocop offenses and made test failures on #test_plausible_common_names and #test_implausible_common_names more clear --- test/faker/creature/test_faker_bird.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index 6491d4de60..fef67b1575 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -41,21 +41,23 @@ def test_common_names def test_plausible_common_names patterns = [ - /[A-Z][a-z]+\'s [a-z]+/, + /[A-Z][a-z]+'s [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? + 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]+'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? + assert patterns.collect { |pattern| pattern.match? name }.any?, + "Faker::Creature::Bird#implausible_common_name failed on '#{name}'" end end From a39f9bae467f237933b40eebfee9f5feea500cd0 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Wed, 14 Apr 2021 13:46:52 -0400 Subject: [PATCH 08/19] fixed TestFakerCreatureBird#test_plausible_common_names to allow for names like "Painted bunting" --- test/faker/creature/test_faker_bird.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index fef67b1575..ab17ef6d54 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -42,6 +42,7 @@ def test_common_names 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]+/ ] From 28e26823abf6ff18a966ae7235699e042230c250 Mon Sep 17 00:00:00 2001 From: Thomas Adriaan Hellinger Date: Sun, 18 Apr 2021 13:36:52 -0400 Subject: [PATCH 09/19] Apply suggestions from code review Co-authored-by: Koichi ITO --- lib/faker/creature/bird.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index db99cd3837..6e77188959 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -7,14 +7,14 @@ class Bird < Base class << self ## - # Produces a random common family name of a bird + # Produces a random common family name of a bird. # # @return [String] # # @example # Faker::Creature::Bird.common_family_name #=> "Owls" # - # @faker.version 2.16.0 + # @faker.version next def common_family_name fetch('creature.bird.common_family_name') end From f22159cbaa6c237c987bb800ef35f4b55ae739d9 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 18 Apr 2021 13:46:29 -0400 Subject: [PATCH 10/19] added a test for #order_with_common_names --- test/faker/creature/test_faker_bird.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index ab17ef6d54..6c253edd47 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -39,6 +39,13 @@ def test_common_names assert @tester.common_name.match(/[a-z]+/) end + def test_order_with_common_names + map = I18n.translate('faker.creature.bird.order_common_map') + entry = @tester.order_with_common_name + assert_includes(map.keys, entry[:order].to_sym) && \ + assert_includes(map[entry[:order]], entry[:common_name]) + end + def test_plausible_common_names patterns = [ /[A-Z][a-z]+'s [a-z]+/, From 2fba0aad1c7352da37c30851a983f6a8f71ab089 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 18 Apr 2021 13:47:24 -0400 Subject: [PATCH 11/19] modified list to allow for matching common names to orders --- lib/faker/creature/bird.rb | 24 +- lib/locales/en/bird.yml | 1661 ++++++++++++++++++------------------ 2 files changed, 854 insertions(+), 831 deletions(-) diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index 6e77188959..33abcc78e1 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -29,7 +29,8 @@ def common_family_name # # @faker.version 2.16.0 def order - fetch('creature.bird.order') + orders = I18n.translate('faker.creature.bird.order_common_map').keys + sample(orders).to_s end ## @@ -135,7 +136,7 @@ def silly_adjective # # @faker.version 2.16.0 def common_name - fetch('creature.bird.common_names').downcase + sample(translate('faker.creature.bird.order_common_map').values.flatten).downcase end ## @@ -163,6 +164,25 @@ def plausible_common_name 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 2.16.0 + def order_with_common_name + map = I18n.translate('faker.creature.bird.order_common_map') + o = order + { order: o, common_name: sample(map[o.to_sym]) } + end end end end diff --git a/lib/locales/en/bird.yml b/lib/locales/en/bird.yml index 2b17061a23..afe272c741 100644 --- a/lib/locales/en/bird.yml +++ b/lib/locales/en/bird.yml @@ -3,48 +3,838 @@ en: faker: creature: bird: - order: - - Accipitriformes - - Anseriformes - - Apterygiformes - - Bucerotiformes - - Caprimulgiformes - - Cariamiformes - - Casuariiformes - - Cathartiformes - - Charadriiformes - - Ciconiiformes - - Coliiformes - - Columbiformes - - Coraciiformes - - Cuculiformes - - Eurypygiformes - - Falconiformes - - Galbuliformes - - Galliformes - - Gaviiformes - - Gruiformes - - Leptosomiformes - - Mesitornithiformes - - Musophagiformes - - Opisthocomiformes - - Otidiformes - - Passeriformes - - Pelecaniformes - - Phaethontiformes - - Phoenicopteriformes - - Piciformes - - Podicipediformes - - Procellariiformes - - Psittaciformes - - Pterocliformes - - Rheiformes - - Sphenisciformes - - Strigiformes - - Struthioniformes - - Suliformes - - Tinamiformes - - Trogoniformes + 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 @@ -223,793 +1013,6 @@ en: - "#{geo} #{emotional_adjective} #{common_name}" - "#{color}-#{anatomy_past_tense} #{silly_adjective} #{common_name}" - "#{color}-#{anatomy_past_tense} #{emotional_adjective} #{common_name}" - common_names: - - Accentor - - Adjutant - - Akalat - - Akekee - - Akepa - - Akialoa - - Akiapolaau - - Akikiki - - Akohekohe - - Alauahio - - Albatross - - Alethe - - Amakihi - - Amaui - - Anhinga - - Ani - - Anianiau - - Antbird - - Antpecker - - Antpipit - - Antpitta - - Antshrike - - Antthrush - - Antvireo - - Antwren - - Apalis - - Apapane - - Apostlebird - - Aracari - - Argus - - Asity - - Astrapia - - Attila - - Auk - - Auklet - - Avadavat - - Avocet - - Avocetbill - - Awlbill - - Babax - - Babbler - - Balicassiao - - Bamboowren - - Bananaquit - - Barbet - - Barbtail - - Barbthroat - - Barwing - - Bateleur - - Batis - - Baywing - - Baza - - Becard - - Bellbird - - Bentbill - - Bernieria - - Berryeater - - Berryhunter - - Berrypecker - - Besra - - Bishop - - Bittern - - Blackbird - - Blackcap - - Blackstart - - Blackthroat - - Blossomcrown - - Bluebill - - Bluebird - - Bluebonnet - - Bluetail - - Bluethroat - - Boatbill - - Bobolink - - Bobwhite - - Bokmakierie - - Boobook - - Booby - - Boubou - - Bowerbird - - Brambling - - Brant - - Brilliant - - Bristlebill - - Bristlebird - - Bristlefront - - Bristlehead - - Broadbill - - Brolga - - Bronzewing - - Brownbul - - Brubru - - Brushfinch - - Brushrunner - - Brushturkey - - Budgerigar - - Bufflehead - - Bulbul - - Bullfinch - - Bunting - - Bushbird - - Bushchat - - Bushlark - - Bushshrike - - Bushtit - - Bustard - - Butcherbird - - Buttonquail - - Buzzard - - Cacholote - - Cacique - - Calyptura - - Camaroptera - - Canary - - Canastero - - Canvasback - - Capercaillie - - Capuchinbird - - Caracara - - Cardinal - - Carib - - Casiornis - - Cassowary - - Catbird - - Chachalaca - - Chaffinch - - Chat - - Chatterer - - Chickadee - - Chiffchaff - - Chilia - - Chlorophonia - - Chlorospingus - - Chough - - Chowchilla - - Chukar - - Cicadabird - - Cinclodes - - Cisticola - - Citril - - Cochoa - - Cockatiel - - Cockatoo - - Coleto - - Comet - - Condor - - Conebill - - Coot - - Coquette - - Cordonbleu - - Corella - - Cormorant - - Coronet - - Cotinga - - Coua - - Coucal - - Courser - - Cowbird - - Crake - - Crane - - Creeper - - Crescentchest - - Crimsonwing - - Crocias - - Crombec - - Crossbill - - Crow - - Cuckoo - - Cuckooshrike - - Cupwing - - Curassow - - Curlew - - Currawong - - Cutia - - Dacnis - - Daggerbill - - Darter - - Dickcissel - - Dipper - - Diucon - - Dodo - - Dollarbird - - Donacobius - - Doradito - - Dotterel - - Dove - - Dovekie - - Dowitcher - - Drongo - - Duck - - Dunlin - - Dunnock - - Eagle - - Earthcreeper - - Egret - - Eider - - Elachura - - Elaenia - - Elepaio - - Emerald - - Emu - - Emutail - - Emuwren - - Eremomela - - Erpornis - - Euphonia - - Fairy - - Fairywren - - Falcon - - Falconet - - Fantail - - Fernbird - - Fernwren - - Fieldfare - - Fieldwren - - Figbird - - Finch - - Finchbill - - Finfoot - - Fireback - - Firecrest - - Firecrown - - Firefinch - - Firetail - - Firethroat - - Fiscal - - Flameback - - Flamecrest - - Flamingo - - Flatbill - - Flicker - - Florican - - Flowerpecker - - Flowerpiercer - - Flufftail - - Flycatcher - - Flyrobin - - Fody - - Forktail - - Francolin - - Friarbird - - Frigatebird - - Frogmouth - - Fruitcrow - - Fruiteater - - Fulmar - - Fulvetta - - Gadwall - - Galah - - Gallinule - - Gallito - - Gannet - - Garganey - - Geomalia - - Gerygone - - Gnatcatcher - - Gnateater - - Gnatwren - - Godwit - - Goldcrest - - Goldeneye - - Goldenface - - Goldentail - - Goldenthroat - - Goldfinch - - Gonolek - - Goose - - Goshawk - - Grackle - - Grandala - - Grassbird - - Grassquit - - Grasswren - - Graveteiro - - Graytail - - Grebe - - Greenbul - - Greenfinch - - Greenlet - - Greenshank - - Grenadier - - Griffon - - Grosbeak - - Groundcreeper - - Grouse - - Guaiabero - - Guan - - Guillemot - - Guineafowl - - Gull - - Gyrfalcon - - Hamerkop - - Hardhead - - Harrier - - Hawfinch - - Hawk - - Heathwren - - Helmetcrest - - Helmetshrike - - Hemispingus - - Hermit - - Heron - - Hillstar - - Hoatzin - - Hobby - - Honeycreeper - - Honeyeater - - Honeyguide - - Hookbill - - Hoopoe - - Hornbill - - Hornero - - Huia - - Hummingbird - - Hwamei - - Hylia - - Hyliota - - Hylocitrea - - Hypocolius - - Ibis - - Ibisbill - - Ibon - - Ifrita - - Iiwi - - Illadopsis - - Inca - - Indigobird - - Iora - - Jabiru - - Jacamar - - Jacana - - Jackdaw - - Jacobin - - Jaeger - - Jay - - Jery - - Jewelfront - - Junco - - Junglefowl - - Kagu - - Kaka - - Kakapo - - Kakawahie - - Kamao - - Kea - - Kestrel - - Killdeer - - Kingbird - - Kingfisher - - Kinglet - - Kioea - - Kiskadee - - Kite - - Kittiwake - - Kiwi - - Knot - - Koel - - Kokako - - Kookaburra - - Lancebill - - Lapwing - - Lark - - Laughingthrush - - Leafbird - - Leaftosser - - Leiothrix - - Limpkin - - Linnet - - Liocichla - - Locustfinch - - Logrunner - - Longbill - - Longclaw - - Longspur - - Longtail - - Loon - - Lophorina - - Lorikeet - - Lory - - Lovebird - - Lyrebird - - Macaw - - Madanga - - Magpie - - Maleo - - Malia - - Malimbe - - Malkoha - - Mallard - - Malleefowl - - Mamo - - Manakin - - Mango - - Mannikin - - Manucode - - Mao - - Marshbird - - Martin - - Meadowlark - - Melampitta - - Melidectes - - Meliphaga - - Merganser - - Merlin - - Mesia - - Mesite - - Metaltail - - Millerbird - - Miner - - Minivet - - Minla - - Mistletoebird - - Mockingbird - - Monal - - Monarch - - Monjita - - Monklet - - Moorhen - - Morepork - - Morningbird - - Motmot - - Mountaineer - - Mourner - - Mousebird - - Munia - - Murre - - Murrelet - - Myna - - Myza - - Myzomela - - Myzornis - - Nativehen - - Needletail - - Negrito - - Newtonia - - Nicator - - Nighthawk - - Nightingale - - Nightjar - - Nigrita - - Niltava - - Noddy - - Nothura - - Nukupuu - - Nunbird - - Nunlet - - Nutcracker - - Nuthatch - - Odedi - - Oilbird - - Oliveback - - Olomao - - Omao - - Oo - - Openbill - - Orangequit - - Oriole - - Oropendola - - Osprey - - Ostrich - - Ou - - Ouzel - - Ovenbird - - Owl - - Owlet - - Oxpecker - - Oxylabes - - Oystercatcher - - Palila - - Palmchat - - Palmcreeper - - Paradigalla - - Parakeet - - Pardalote - - Pardusco - - Parisoma - - Parotia - - Parrot - - Parrotbill - - Parrotfinch - - Parrotlet - - Partridge - - Parula - - Pauraque - - Peacock - - Peafowl - - Pelican - - Peltops - - Penguin - - Peppershrike - - Petrel - - Pewee - - Phainopepla - - Phalarope - - Pheasant - - Philentoma - - Phoebe - - Piapiac - - Piculet - - Piedtail - - Pigeon - - Piha - - Pilotbird - - Pinktail - - Pintail - - Piopio - - Pipipi - - Pipit - - Piprites - - Pitohui - - Pitta - - Plantcutter - - Ploughbill - - Plover - - Plovercrest - - Plumeleteer - - Plushcap - - Plushcrown - - Pochard - - Poorwill - - Potoo - - Pratincole - - Prickletail - - Prinia - - Prion - - Ptarmigan - - Puaiohi - - Puffback - - Puffbird - - Puffin - - Puffleg - - Purpletuft - - Pyrrhuloxia - - Pytilia - - Quail - - Quailfinch - - Quelea - - Quetzal - - Rail - - Raven - - Rayadito - - Razorbill - - Recurvebill - - Redhead - - Redpoll - - Redshank - - Redstart - - Redthroat - - Redwing - - Reedhaunter - - Reedling - - Rhabdornis - - Rhea - - Riflebird - - Rifleman - - Ringneck - - Roadrunner - - Robin - - Rockfinch - - Rockfowl - - Rockjumper - - Rockrunner - - Rockwarbler - - Roller - - Rook - - Rosefinch - - Rosella - - Ruby - - Rubythroat - - Ruff - - Rushbird - - Sabrewing - - Saddleback - - Saltator - - Sanderling - - Sandgrouse - - Sandpiper - - Sapayoa - - Sapphire - - Sapphirewing - - Sapsucker - - Satinbird - - Sawwing - - Scaup - - Schiffornis - - Scimitarbill - - Scoter - - Screamer - - Scrubfowl - - Scrubtit - - Scrubwren - - Scythebill - - Secretarybird - - Seedcracker - - Seedeater - - Seedsnipe - - Seriema - - Serin - - Shag - - Shama - - Sharpbill - - Sheartail - - Shearwater - - Sheathbill - - Shelduck - - Shikra - - Shoebill - - Sholakili - - Shortwing - - Shoveler - - Shrike - - Shrikebill - - Shrikejay - - Shrikethrush - - Sibia - - Sicklebill - - Silktail - - Silverbill - - Silverbird - - Silvereye - - Sirystes - - Siskin - - Sittella - - Skimmer - - Skua - - Skylark - - Smew - - Snipe - - Snowcap - - Snowcock - - Snowfinch - - Softtail - - Solitaire - - Songlark - - Sora - - Spadebill - - Sparrow - - Sparrowhawk - - Spatuletail - - Speirops - - Spiderhunter - - Spindalis - - Spinebill - - Spinetail - - Spinifexbird - - Spoonbill - - Spurfowl - - Starfrontlet - - Starling - - Starthroat - - Stilt - - Stint - - Stipplethroat - - Stitchbird - - Stonechat - - Stork - - Straightbill - - Streamcreeper - - Streamertail - - Stubtail - - Sugarbird - - Sunangel - - Sunbeam - - Sunbird - - Sunbittern - - Sungem - - Sungrebe - - Surfbird - - Swallow - - Swamphen - - Swan - - Swift - - Swiftlet - - Sylph - - Tachuri - - Tailorbird - - Takahe - - Tanager - - Tapaculo - - Tattler - - Tchagra - - Teal - - Tern - - Tesia - - Tetraka - - Thamnornis - - Thicketbird - - Thistletail - - Thornbill - - Thornbird - - Thorntail - - Thrasher - - Thrush - - Tinamou - - Tinkerbird - - Tit - - Titmouse - - Tityra - - Tody - - Tomtit - - Topaz - - Toucan - - Toucanet - - Towhee - - Tragopan - - Trainbearer - - Treecreeper - - Treehunter - - Treepie - - Treerunner - - Treeswift - - Trembler - - Triller - - Trogon - - Tropicbird - - Troupial - - Trumpeter - - Tuftedcheek - - Tui - - Turaco - - Turca - - Turkey - - Turnstone - - Twinspot - - Twistwing - - Twite - - Tyrannulet - - Tyrant - - Umbrellabird - - Vanga - - Veery - - Velvetbreast - - Verdin - - Violetear - - Vireo - - Visorbearer - - Vulture - - Wagtail - - Wallcreeper - - Warbler - - Watercock - - Waterhen - - Waterthrush - - Wattlebird - - Waxbill - - Waxwing - - Weaver - - Wedgebill - - Weebill - - Weka - - Wheatear - - Whimbrel - - Whinchat - - Whipbird - - Whistler - - Whiteface - - Whitehead - - Whitethroat - - Whitetip - - Whydah - - Widowbird - - Wigeon - - Willet - - Wiretail - - Woodcock - - Woodcreeper - - Woodhaunter - - Woodhoopoe - - Woodnymph - - Woodpecker - - Woodshrike - - Woodstar - - Woodswallow - - Wren - - Wrenthrush - - Wrentit - - Wrybill - - Wryneck - - Xenops - - Xenopsaris - - Yellowhammer - - Yellowhead - - Yellowlegs - - Yellownape - - Yellowthroat - - Yuhina common_family_name: - Accentors - African Barbets From 99a7ff43d2d1d9351a762e64a662c21a45ce8eda Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 18 Apr 2021 14:27:54 -0400 Subject: [PATCH 12/19] tests for new versions of Faker::Creature::Bird #order_with_common_names and #common_name accepts a parameter for the order to restrict on --- test/faker/creature/test_faker_bird.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index 6c253edd47..e91b1b8afa 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -5,6 +5,7 @@ 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 @@ -39,11 +40,22 @@ 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], name + end + def test_order_with_common_names - map = I18n.translate('faker.creature.bird.order_common_map') entry = @tester.order_with_common_name - assert_includes(map.keys, entry[:order].to_sym) && \ - assert_includes(map[entry[:order]], entry[: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 From 95fc7152c9a34da589dfc46d0121e4bad0e7f371 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 18 Apr 2021 18:49:01 -0400 Subject: [PATCH 13/19] added tests to make sure that Faker::Creature::Bird #common_name and #order_with_common_names work properly --- test/faker/creature/test_faker_bird.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index e91b1b8afa..2d03e17b88 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -43,7 +43,17 @@ def test_common_names 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], name + 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 From 824072fe3dbbb4e8692e39bde7881fab8db35d98 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Sun, 18 Apr 2021 18:50:35 -0400 Subject: [PATCH 14/19] corrected Faker::Creature::Bird #order_with_common_name and made #common_name more robust when passed a bad parameter --- lib/faker/creature/bird.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index 33abcc78e1..24241132d3 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -129,14 +129,27 @@ def silly_adjective ## # 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 2.16.0 - def common_name - sample(translate('faker.creature.bird.order_common_map').values.flatten).downcase + 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.to_s} 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 ## @@ -178,9 +191,9 @@ def implausible_common_name # } # # @faker.version 2.16.0 - def order_with_common_name + def order_with_common_name(tax_order = nil) map = I18n.translate('faker.creature.bird.order_common_map') - o = order + o = tax_order.nil? ? order : tax_order { order: o, common_name: sample(map[o.to_sym]) } end end From fdb504f740d8ef9b2d996eeb4bc456a57cd6a776 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Mon, 19 Apr 2021 10:43:45 -0400 Subject: [PATCH 15/19] changed @faker.version to correct next version --- lib/faker/creature/bird.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index 24241132d3..d88c60ece5 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -27,7 +27,7 @@ def common_family_name # @example # Faker::Creature::Bird.order #=> "Passeriformes" # - # @faker.version 2.16.0 + # @faker.version next def order orders = I18n.translate('faker.creature.bird.order_common_map').keys sample(orders).to_s @@ -41,7 +41,7 @@ def order # @example # Faker::Creature::Bird.anatomy #=> "rump" # - # @faker.version 2.16.0 + # @faker.version next def anatomy fetch('creature.bird.anatomy') end @@ -54,7 +54,7 @@ def anatomy # @example # Faker::Creature::Bird.anatomy #=> "breasted" # - # @faker.version 2.16.0 + # @faker.version next def anatomy_past_tense fetch('creature.bird.anatomy_past_tense') end @@ -67,7 +67,7 @@ def anatomy_past_tense # @example # Faker::Creature::Bird.geo #=> "Eurasian" # - # @faker.version 2.16.0 + # @faker.version next def geo fetch('creature.bird.geo') end @@ -80,7 +80,7 @@ def geo # @example # Faker::Creature::Bird.color #=> "ferruginous" # - # @faker.version 2.16.0 + # @faker.version next def color fetch('creature.bird.colors') end @@ -93,7 +93,7 @@ def color # @example # Faker::Creature::Bird.adjective #=> 'common' # - # @faker.version 2.16.0 + # @faker.version next def adjective fetch('creature.bird.adjectives') end @@ -107,7 +107,7 @@ def adjective # @example # Faker::Creature::Bird.emotional_adjective #=> 'cantankerous' # - # @faker.version 2.16.0 + # @faker.version next def emotional_adjective fetch('creature.bird.emotional_adjectives') end @@ -121,7 +121,7 @@ def emotional_adjective # @example # Faker::Creature::Bird.silly_adjective #=> 'drunk' # - # @faker.version 2.16.0 + # @faker.version next def silly_adjective fetch('creature.bird.silly_adjectives') end @@ -137,7 +137,7 @@ def silly_adjective # @example # Faker::Creature::Bird.common_name #=> 'wren' # - # @faker.version 2.16.0 + # @faker.version next def common_name(tax_order = nil) map = translate('faker.creature.bird.order_common_map') if tax_order.nil? @@ -160,7 +160,7 @@ def common_name(tax_order = nil) # @example # Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren' # - # @faker.version 2.16.0 + # @faker.version next def plausible_common_name parse('creature.bird.plausible_common_names').capitalize end @@ -173,7 +173,7 @@ def plausible_common_name # @example # Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee' # - # @faker.version 2.16.0 + # @faker.version next def implausible_common_name parse('creature.bird.implausible_common_names').capitalize end @@ -190,7 +190,7 @@ def implausible_common_name # common_name: 'Osprey' # } # - # @faker.version 2.16.0 + # @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 From 52886782badddcb46363400fa363fe72dd462fe5 Mon Sep 17 00:00:00 2001 From: brotherjack Date: Mon, 19 Apr 2021 10:45:04 -0400 Subject: [PATCH 16/19] corrected rubocop offenses --- lib/faker/creature/bird.rb | 5 +++-- test/faker/creature/test_faker_bird.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/faker/creature/bird.rb b/lib/faker/creature/bird.rb index d88c60ece5..d1a016d1ea 100644 --- a/lib/faker/creature/bird.rb +++ b/lib/faker/creature/bird.rb @@ -145,8 +145,9 @@ def common_name(tax_order = nil) else raise TypeError, 'tax_order parameter must be symbolizable' \ unless tax_order.respond_to?(:to_sym) - raise ArgumentError, "#{tax_order.to_s} is not a valid taxonomic order" \ - unless map.keys.include?(tax_order.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 diff --git a/test/faker/creature/test_faker_bird.rb b/test/faker/creature/test_faker_bird.rb index 2d03e17b88..88800d041d 100644 --- a/test/faker/creature/test_faker_bird.rb +++ b/test/faker/creature/test_faker_bird.rb @@ -48,7 +48,7 @@ def test_common_names_with_specific_order def test_common_names_with_specific_but_imaginary_order not_real_order = :Somethingaformes - assert_raises(ArgumentError) { @tester.common_name not_real_order} + assert_raises(ArgumentError) { @tester.common_name not_real_order } end def test_common_name_with_bad_parameter From cb1403dd3737c10f78ffb601586d24113b1ca51f Mon Sep 17 00:00:00 2001 From: brotherjack Date: Mon, 19 Apr 2021 10:54:23 -0400 Subject: [PATCH 17/19] updated documentation --- README.md | 1 + doc/creature/bird.md | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index ca857bbf5a..95fe13fe40 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,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 index d35f9bdbfb..d6946d4d03 100644 --- a/doc/creature/bird.md +++ b/doc/creature/bird.md @@ -36,4 +36,7 @@ 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"} ``` From 9dcf76924c135559a1c9900fd5ca9dd9cd1699ec Mon Sep 17 00:00:00 2001 From: brotherjack Date: Mon, 19 Apr 2021 11:04:17 -0400 Subject: [PATCH 18/19] added additional silly - management apologizes for the insufficient irreverance of previous birb offerings --- lib/locales/en/bird.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/locales/en/bird.yml b/lib/locales/en/bird.yml index afe272c741..96fdb4f508 100644 --- a/lib/locales/en/bird.yml +++ b/lib/locales/en/bird.yml @@ -977,12 +977,28 @@ en: - 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 From fa3cc07836de131d4cd7344c2b667adf98fb41e1 Mon Sep 17 00:00:00 2001 From: Thomas Adriaan Hellinger Date: Tue, 20 Apr 2021 09:57:46 -0400 Subject: [PATCH 19/19] Fix typo in documentation doc/creature/bird.md Co-authored-by: Koichi ITO --- doc/creature/bird.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/creature/bird.md b/doc/creature/bird.md index d6946d4d03..318fb9eca4 100644 --- a/doc/creature/bird.md +++ b/doc/creature/bird.md @@ -11,7 +11,7 @@ Faker::Creature::Bird.order #=> "Passeriformes" # Fun fact, 60% of birds are Pas Faker::Creature::Bird.anatomy #=> "rump" # Random bird anatomy word, in the past tense -Faker::Creature::Bird.anatomy #=> "breasted" +Faker::Creature::Bird.anatomy_past_tense #=> "breasted" # Random bird geography word Faker::Creature::Bird.geo #=> "Eurasian"