Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Contents
- [Faker::Buffy](doc/buffy.md)
- [Faker::Business](doc/business.md)
- [Faker::Cannabis](doc/cannabis.md)
- [Faker::Cat](doc/cat.md)
- [Faker::ChileRut](doc/chile_rut.md)
- [Faker::ChuckNorris](doc/chuck_norris.md)
- [Faker::Code](doc/code.md)
Expand All @@ -57,6 +56,8 @@ Contents
- [Faker::Construction](doc/construction.md)
- [Faker::Cosmere](doc/cosmere.md)
- [Faker::Creature::Animal](doc/animal.md)
- [Faker::Creature::Cat](doc/cat.md)
- [Faker::Creature::Dog](doc/dog.md)
- [Faker::Crypto](doc/crypto.md)
- [Faker::CryptoCoin](doc/crypto_coin.md)
- [Faker::Currency](doc/currency.md)
Expand All @@ -65,7 +66,6 @@ Contents
- [Faker::Demographic](doc/demographic.md)
- [Faker::Dessert](doc/dessert.md)
- [Faker::Device](doc/device.md)
- [Faker::Dog](doc/dog.md)
- [Faker::Dota](doc/dota.md)
- [Faker::DrWho](doc/dr_who.md)
- [Faker::DumbAndDumber](doc/dumb_and_dumber.md)
Expand Down
8 changes: 4 additions & 4 deletions doc/cat.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Faker::Cat
# Faker::Creature::Cat

Available since version 1.6.2.

```ruby
# Random cat name
Faker::Cat.name #=> "Shadow"
Faker::Creature::Cat.name #=> "Shadow"

# Random cat breed
Faker::Cat.breed #=> "British Semipi-longhair"
Faker::Creature::Cat.breed #=> "British Semipi-longhair"

# Random cat registry
Faker::Cat.registry #=> "American Cat Fanciers Association"
Faker::Creature::Cat.registry #=> "American Cat Fanciers Association"
```
20 changes: 10 additions & 10 deletions doc/dog.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Faker::Dog
# Faker::Creature::Dog

```ruby
# Random dog name
Faker::Dog.name #=> "Spike"
Faker::Creature::Dog.name #=> "Spike"

# Random dog breed
Faker::Dog.breed #=> "Yorkshire Terrier"
Faker::Creature::Dog.breed #=> "Yorkshire Terrier"

# Random dog sound
Faker::Dog.sound #=> "woof woof"
Faker::Creature::Dog.sound #=> "woof woof"

# Random dog meme phrase
Faker::Dog.meme_phrase #=> "smol pupperino"
Faker::Creature::Dog.meme_phrase #=> "smol pupperino"

# Random dog age
Faker::Dog.age #=> "puppy"
Faker::Creature::Dog.age #=> "puppy"

# Random dog gender
Faker::Dog.gender #=> "female"
Faker::Creature::Dog.gender #=> "female"

# Random dog coat length
Faker::Dog.coat_length #=> "short"
Faker::Creature::Dog.coat_length #=> "short"

# Random dog size
Faker::Dog.size #=> "small"
```
Faker::Creature::Dog.size #=> "small"
```
16 changes: 10 additions & 6 deletions lib/faker/cat.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# frozen_string_literal: true

module Faker
class Cat < Base
flexible :cat

module Cat
class << self
extend Gem::Deprecate

def name
fetch('cat.name')
Faker::Creature::Cat.name
end

def breed
fetch('cat.breed')
Faker::Creature::Cat.breed
end

def registry
fetch('cat.registry')
Faker::Creature::Cat.registry
end

deprecate :name, 'Faker::Creature::Cat.name', 2018, 10
deprecate :breed, 'Faker::Creature::Cat.breed', 2018, 10
deprecate :registry, 'Faker::Creature::Cat.registry', 2018, 10
end
end
end
23 changes: 23 additions & 0 deletions lib/faker/creature/cat.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Faker
module Creature
class Cat < Base
flexible :cat

class << self
def name
fetch('creature.cat.name')
end

def breed
fetch('creature.cat.breed')
end

def registry
fetch('creature.cat.registry')
end
end
end
end
end
43 changes: 43 additions & 0 deletions lib/faker/creature/dog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

module Faker
module Creature
class Dog < Base
flexible :dog

class << self
def name
fetch('creature.dog.name')
end

def breed
fetch('creature.dog.breed')
end

def sound
fetch('creature.dog.sound')
end

def meme_phrase
fetch('creature.dog.meme_phrase')
end

def age
fetch('creature.dog.age')
end

def gender
Faker::Gender.binary_type
end

def coat_length
fetch('creature.dog.coat_length')
end

def size
fetch('creature.dog.size')
end
end
end
end
end
31 changes: 20 additions & 11 deletions lib/faker/dog.rb
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
# frozen_string_literal: true

module Faker
class Dog < Base
flexible :dog

module Dog
class << self
extend Gem::Deprecate

def name
fetch('dog.name')
Faker::Creature::Dog.name
end

def breed
fetch('dog.breed')
Faker::Creature::Dog.breed
end

def sound
fetch('dog.sound')
Faker::Creature::Dog.sound
end

def meme_phrase
fetch('dog.meme_phrase')
Faker::Creature::Dog.meme_phrase
end

def age
fetch('dog.age')
Faker::Creature::Dog.age
end

def gender
fetch('dog.gender')
Faker::Creature::Dog.gender
end

def coat_length
fetch('dog.coat_length')
Faker::Creature::Dog.coat_length
end

def size
fetch('dog.size')
Faker::Creature::Dog.size
end

deprecate :name, 'Faker::Creature::Dog.name', 2018, 10
deprecate :breed, 'Faker::Creature::Dog.breed', 2018, 10
deprecate :sound, 'Faker::Creature::Dog.sound', 2018, 10
deprecate :meme_phrase, 'Faker::Creature::Dog.meme_phrase', 2018, 10
deprecate :age, 'Faker::Creature::Dog.age', 2018, 10
deprecate :gender, 'Faker::Creature::Dog.gender', 2018, 10
deprecate :coat_length, 'Faker::Creature::Dog.coat_length', 2018, 10
deprecate :size, 'Faker::Creature::Dog.size', 2018, 10
end
end
end
9 changes: 5 additions & 4 deletions lib/locales/en/cat.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
en:
faker:
cat:
name: ["Alfie", "Angel", "Bella", "Charlie", "Chloe", "Coco", "Daisy", "Felix", "Jasper", "Lily", "Lucky", "Lucy", "Max", "Millie", "Milo", "Missy", "Misty", "Molly", "Oliver", "Oscar", "Poppy", "Sam", "Shadow", "Simba", "Smokey", "Smudge", "Sooty", "Tiger"]
breed: ["Abyssinian", "Aegean", "American Bobtail", "American Curl", "American Shorthair", "American Wirehair", "Arabian Mau", "Asian", "Asian Semi-longhair", "Australian Mist", "Balinese", "Bambino", "Bengal", "Birman", "Bombay", "Brazilian Shorthair", "British Longhair", "British Semipi-longhair", "British Shorthair", "Burmese", "Burmilla", "California Spangled", "Chantilly-Tiffany", "Chartreux", "Chausie", "Cheetoh", "Colorpoint Shorthair", "Cornish Rex", "Cymric, or Manx Longhair", "Cyprus", "Devon Rex", "Donskoy, or Don Sphynx", "Dragon Li", "Dwarf cat, or Dwelf", "Egyptian Mau", "European Shorthair", "Exotic Shorthair", "Foldex Cat", "German Rex", "Havana Brown", "Highlander", "Himalayan, or Colorpoint Persian", "Japanese Bobtail", "Javanese", "Khao Manee", "Korat", "Korean Bobtail", "Korn Ja", "Kurilian Bobtail", "Kurilian Bobtail, or Kuril Islands Bobtail", "LaPerm", "Lykoi", "Maine Coon", "Manx", "Mekong Bobtail", "Minskin", "Munchkin", "Napoleon", "Nebelung", "Norwegian Forest Cat", "Ocicat", "Ojos Azules", "Oregon Rex", "Oriental Bicolor", "Oriental Longhair", "Oriental Shorthair", "PerFold Cat (Experimental Breed - WCF)", "Persian (Modern Persian Cat)", "Persian (Traditional Persian Cat)", "Peterbald", "Pixie-bob", "Raas", "Ragamuffin", "Ragdoll", "Russian Blue", "Russian White, Black and Tabby", "Sam Sawet", "Savannah", "Scottish Fold", "Selkirk Rex", "Serengeti", "Serrade petit", "Siamese", "Siberian", "Singapura", "Snowshoe", "Sokoke", "Somali", "Sphynx", "Suphalak", "Thai", "Tonkinese", "Toyger", "Turkish Angora", "Turkish Van", "Ukrainian Levkoy"]
registry: ["American Cat Fanciers Association", "Associazione Nazionale Felina Italiana", "Canadian Cat Association", "Cat Aficionado Association", "Cat Fanciers' Association", "Emirates Feline Federation", "Fédération Internationale Féline", "Felis Britannica", "Governing Council of the Cat", "Fancy Southern Africa Cat Council", "The International Cat Association"]
creature:
cat:
name: ["Alfie", "Angel", "Bella", "Charlie", "Chloe", "Coco", "Daisy", "Felix", "Jasper", "Lily", "Lucky", "Lucy", "Max", "Millie", "Milo", "Missy", "Misty", "Molly", "Oliver", "Oscar", "Poppy", "Sam", "Shadow", "Simba", "Smokey", "Smudge", "Sooty", "Tiger"]
breed: ["Abyssinian", "Aegean", "American Bobtail", "American Curl", "American Shorthair", "American Wirehair", "Arabian Mau", "Asian", "Asian Semi-longhair", "Australian Mist", "Balinese", "Bambino", "Bengal", "Birman", "Bombay", "Brazilian Shorthair", "British Longhair", "British Semipi-longhair", "British Shorthair", "Burmese", "Burmilla", "California Spangled", "Chantilly-Tiffany", "Chartreux", "Chausie", "Cheetoh", "Colorpoint Shorthair", "Cornish Rex", "Cymric, or Manx Longhair", "Cyprus", "Devon Rex", "Donskoy, or Don Sphynx", "Dragon Li", "Dwarf cat, or Dwelf", "Egyptian Mau", "European Shorthair", "Exotic Shorthair", "Foldex Cat", "German Rex", "Havana Brown", "Highlander", "Himalayan, or Colorpoint Persian", "Japanese Bobtail", "Javanese", "Khao Manee", "Korat", "Korean Bobtail", "Korn Ja", "Kurilian Bobtail", "Kurilian Bobtail, or Kuril Islands Bobtail", "LaPerm", "Lykoi", "Maine Coon", "Manx", "Mekong Bobtail", "Minskin", "Munchkin", "Napoleon", "Nebelung", "Norwegian Forest Cat", "Ocicat", "Ojos Azules", "Oregon Rex", "Oriental Bicolor", "Oriental Longhair", "Oriental Shorthair", "PerFold Cat (Experimental Breed - WCF)", "Persian (Modern Persian Cat)", "Persian (Traditional Persian Cat)", "Peterbald", "Pixie-bob", "Raas", "Ragamuffin", "Ragdoll", "Russian Blue", "Russian White, Black and Tabby", "Sam Sawet", "Savannah", "Scottish Fold", "Selkirk Rex", "Serengeti", "Serrade petit", "Siamese", "Siberian", "Singapura", "Snowshoe", "Sokoke", "Somali", "Sphynx", "Suphalak", "Thai", "Tonkinese", "Toyger", "Turkish Angora", "Turkish Van", "Ukrainian Levkoy"]
registry: ["American Cat Fanciers Association", "Associazione Nazionale Felina Italiana", "Canadian Cat Association", "Cat Aficionado Association", "Cat Fanciers' Association", "Emirates Feline Federation", "Fédération Internationale Féline", "Felis Britannica", "Governing Council of the Cat", "Fancy Southern Africa Cat Council", "The International Cat Association"]
18 changes: 9 additions & 9 deletions lib/locales/en/dog.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
en:
faker:
dog:
name: ["Buddy", "Max", "Bella", "Daisy", "Molly", "Rocky", "Lucy", "Bear", "Bailey", "Lucky", "Harley", "Maggie", "Princess", "Angel", "Charlie", "Sadie", "Jack", "Shadow", "Jake", "Coco", "Gizmo", "Chloe", "Sophie", "Toby", "Roxy", "Buster", "Ginger", "Lady", "Duke", "Baby", "Peanut", "Bandit", "Abby", "Sasha", "Lola", "Zoey", "Pepper", "Sam", "Gracie", "Sammy", "Precious", "Missy", "Riley", "Spike", "Lily", "Sassy", "Cooper", "Rusty", "Dakota", "Dixie", "Cody", "Lilly", "Zoe", "Cookie", "Chico", "Zeus", "Tucker", "Oreo", "Teddy", "Marley", "Oscar", "Honey", "Rex", "Tank", "Sugar", "Sandy", "Penny", "Tyson", "Chance", "Mia", "Diamond", "Bubba", "Blue", "Belle", "Shelby", "Rosie", "Casey", "Ruby", "Snoopy", "Cocoa", "Jasmine", "Diesel", "Patches", "Annie", "Sparky", "Taz", "Bruno", "Roxie", "Lexi", "Scooter", "Jasper", "Brutus", "Baxter", "Luna", "Snickers", "Misty", "Rascal", "Milo", "Murphy", "Bo", "Harvey"]
breed: ["Affenpinscher", "African", "Airedale", "Akita", "Appenzeller", "Basenji", "Beagle", "Bluetick", "Borzoi", "Bouvier", "Boxer", "Brabancon", "Briard", "Boston Bulldog", "French Bulldog", "Staffordshire Bullterrier", "Cairn", "Chihuahua", "Chow", "Clumber", "Border Collie", "Coonhound", "Cardigan Corgi", "Dachshund", "Great Dane", "Scottish Deerhound", "Dhole", "Dingo", "Doberman", "Norwegian Elkhound", "Entlebucher", "Eskimo", "Germanshepherd", "Italian Greyhound", "Groenendael", "Ibizan Hound", "Afghan Hound", "Basset Hound", "Blood Hound", "English Hound", "Walker Hound", "Husky", "Keeshond", "Kelpie", "Komondor", "Kuvasz", "Labrador", "Leonberg", "Lhasa", "Malamute", "Malinois", "Maltese", "Bull Mastiff", "Tibetan Mastiff", "Mexicanhairless", "Bernese Mountain", "Swiss Mountain", "Newfoundland", "Otterhound", "Papillon", "Pekinese", "Pembroke", "Miniature Pinscher", "German Pointer", "Pomeranian", "Miniature Poodle", "Standard Poodle", "Toy Poodle", "Pug", "Pyrenees", "Redbone", "Chesapeake Retriever", "Curly Retriever", "Flatcoated Retriever", "Golden Retriever", "Rhodesian Ridgeback", "Rottweiler", "Saluki", "Samoyed", "Schipperke", "Giant Schnauzer", "Miniature Schnauzer", "English Setter", "Gordon Setter", "Irish Setter", "English Sheepdog", "Shetland Sheepdog", "Shiba", "Shihtzu", "Blenheim Spaniel", "Brittany Spaniel", "Cocker Spaniel", "Irish Spaniel", "Japanese Spaniel", "Sussex Spaniel", "Welsh Spaniel", "English Springer", "Stbernard", "American Terrier", "Australian Terrier", "Bedlington Terrier", "Border Terrier", "Dandie Terrier", "Fox Terrier", "Irish Terrier", "Kerryblue Terrier", "Lakeland Terrier", "Norfolk Terrier", "Norwich Terrier", "Patterdale Terrier", "Rat Terrier", "Scottish Terrier", "Sealyham Terrier", "Silky Terrier", "Tibetan Terrier", "Toy Terrier", "Westhighland Terrier", "Wheaten Terrier", "Yorkshire Terrier", "Vizsla", "Weimaraner", "Whippet", "Irish Wolfhound"]
sound: ["woof", "woof woof", "bow wow", "ruff", "owooooo", "grrrrrr"]
meme_phrase: ["heck no pal", "11/10", "boop the snoot", "mlem", "blep", "long boi", "thicc doggo", "big ol' pupper", "smol pupperino", "zoom", "they're good dogs Brent"]
age: ["puppy", "young", "adult", "senior"]
coat_length: ["hairless", "short", "medium", "long", "wire", "curly"]
gender: ["female", "male"]
size: ["small", "medium", "large", "extra large"]
creature:
dog:
name: ["Buddy", "Max", "Bella", "Daisy", "Molly", "Rocky", "Lucy", "Bear", "Bailey", "Lucky", "Harley", "Maggie", "Princess", "Angel", "Charlie", "Sadie", "Jack", "Shadow", "Jake", "Coco", "Gizmo", "Chloe", "Sophie", "Toby", "Roxy", "Buster", "Ginger", "Lady", "Duke", "Baby", "Peanut", "Bandit", "Abby", "Sasha", "Lola", "Zoey", "Pepper", "Sam", "Gracie", "Sammy", "Precious", "Missy", "Riley", "Spike", "Lily", "Sassy", "Cooper", "Rusty", "Dakota", "Dixie", "Cody", "Lilly", "Zoe", "Cookie", "Chico", "Zeus", "Tucker", "Oreo", "Teddy", "Marley", "Oscar", "Honey", "Rex", "Tank", "Sugar", "Sandy", "Penny", "Tyson", "Chance", "Mia", "Diamond", "Bubba", "Blue", "Belle", "Shelby", "Rosie", "Casey", "Ruby", "Snoopy", "Cocoa", "Jasmine", "Diesel", "Patches", "Annie", "Sparky", "Taz", "Bruno", "Roxie", "Lexi", "Scooter", "Jasper", "Brutus", "Baxter", "Luna", "Snickers", "Misty", "Rascal", "Milo", "Murphy", "Bo", "Harvey"]
breed: ["Affenpinscher", "African", "Airedale", "Akita", "Appenzeller", "Basenji", "Beagle", "Bluetick", "Borzoi", "Bouvier", "Boxer", "Brabancon", "Briard", "Boston Bulldog", "French Bulldog", "Staffordshire Bullterrier", "Cairn", "Chihuahua", "Chow", "Clumber", "Border Collie", "Coonhound", "Cardigan Corgi", "Dachshund", "Great Dane", "Scottish Deerhound", "Dhole", "Dingo", "Doberman", "Norwegian Elkhound", "Entlebucher", "Eskimo", "Germanshepherd", "Italian Greyhound", "Groenendael", "Ibizan Hound", "Afghan Hound", "Basset Hound", "Blood Hound", "English Hound", "Walker Hound", "Husky", "Keeshond", "Kelpie", "Komondor", "Kuvasz", "Labrador", "Leonberg", "Lhasa", "Malamute", "Malinois", "Maltese", "Bull Mastiff", "Tibetan Mastiff", "Mexicanhairless", "Bernese Mountain", "Swiss Mountain", "Newfoundland", "Otterhound", "Papillon", "Pekinese", "Pembroke", "Miniature Pinscher", "German Pointer", "Pomeranian", "Miniature Poodle", "Standard Poodle", "Toy Poodle", "Pug", "Pyrenees", "Redbone", "Chesapeake Retriever", "Curly Retriever", "Flatcoated Retriever", "Golden Retriever", "Rhodesian Ridgeback", "Rottweiler", "Saluki", "Samoyed", "Schipperke", "Giant Schnauzer", "Miniature Schnauzer", "English Setter", "Gordon Setter", "Irish Setter", "English Sheepdog", "Shetland Sheepdog", "Shiba", "Shihtzu", "Blenheim Spaniel", "Brittany Spaniel", "Cocker Spaniel", "Irish Spaniel", "Japanese Spaniel", "Sussex Spaniel", "Welsh Spaniel", "English Springer", "Stbernard", "American Terrier", "Australian Terrier", "Bedlington Terrier", "Border Terrier", "Dandie Terrier", "Fox Terrier", "Irish Terrier", "Kerryblue Terrier", "Lakeland Terrier", "Norfolk Terrier", "Norwich Terrier", "Patterdale Terrier", "Rat Terrier", "Scottish Terrier", "Sealyham Terrier", "Silky Terrier", "Tibetan Terrier", "Toy Terrier", "Westhighland Terrier", "Wheaten Terrier", "Yorkshire Terrier", "Vizsla", "Weimaraner", "Whippet", "Irish Wolfhound"]
sound: ["woof", "woof woof", "bow wow", "ruff", "owooooo", "grrrrrr"]
meme_phrase: ["heck no pal", "11/10", "boop the snoot", "mlem", "blep", "long boi", "thicc doggo", "big ol' pupper", "smol pupperino", "zoom", "they're good dogs Brent"]
age: ["puppy", "young", "adult", "senior"]
coat_length: ["hairless", "short", "medium", "long", "wire", "curly"]
size: ["small", "medium", "large", "extra large"]
21 changes: 21 additions & 0 deletions test/test_deprecate_cat.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

require_relative 'test_helper'

class TestDeprecateCat < Test::Unit::TestCase
def setup
@tester = Faker::Cat
end

def test_name
assert @tester.name.match(/\w+\.?/)
end

def test_breed
assert @tester.breed.match(/\w+\.?/)
end

def test_registry
assert @tester.registry.match(/\w+\.?/)
end
end
41 changes: 41 additions & 0 deletions test/test_deprecate_dog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

require_relative 'test_helper'

class TestDeprecateDog < Test::Unit::TestCase
def setup
@tester = Faker::Dog
end

def test_name
assert @tester.name.match(/\w+\.?/)
end

def test_breed
assert @tester.breed.match(/\w+\.?/)
end

def test_sound
assert @tester.sound.match(/\w+\.?/)
end

def test_meme_phrase
assert @tester.meme_phrase.match(/\w+\.?/)
end

def test_age
assert @tester.age.match(/\w+\.?/)
end

def test_gender
assert @tester.gender.match(/\w+\.?/)
end

def test_coat_length
assert @tester.coat_length.match(/\w+\.?/)
end

def test_size
assert @tester.size.match(/\w+\.?/)
end
end
2 changes: 1 addition & 1 deletion test/test_determinism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def all_methods

def subclasses
Faker.constants.delete_if do |subclass|
%i[Base Bank Char Base58 ChileRut Config Creature Date DragonBall Games GamesHalfLife Internet JapaneseMedia Movies OnePiece SwordArtOnline Time VERSION].include?(subclass)
%i[Base Bank Cat Char Base58 ChileRut Config Creature Date Dog DragonBall Games GamesHalfLife Internet JapaneseMedia Movies OnePiece SwordArtOnline Time VERSION].include?(subclass)
end.sort
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_faker_cat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestFakerCat < Test::Unit::TestCase
def setup
@tester = Faker::Cat
@tester = Faker::Creature::Cat
end

def test_name
Expand Down
2 changes: 1 addition & 1 deletion test/test_faker_dog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestFakerDog < Test::Unit::TestCase
def setup
@tester = Faker::Dog
@tester = Faker::Creature::Dog
end

def test_name
Expand Down