Skip to content

Commit

Permalink
Added: Faker.Food (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrazo authored and Igor Kapkov committed Apr 25, 2018
1 parent b245a83 commit 13427ad
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -30,6 +30,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format.

### Added

* `Faker.Food` added to generate Food data [@vbrazo][]
* New maintainer [Toby Hinloopen (@tobyhinloopen)](https://github.com/tobyhinloopen)
* Gitter chat [room](https://gitter.im/igas/faker) [[@igas][]]
* `Faker.Gov.Us.ssn/0` added to generate US Social Security numbers [[@sotojuan][]]
Expand Down Expand Up @@ -281,6 +282,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format.
[@stfnsr]: https://github.com/stfnsr
[@tbash]: https://github.com/tbash
[@tobyhinloopen]: https://github.com/tobyhinloopen
[@vbrazo]: https://github.com/vbrazo
[@vforvova]: https://github.com/vforvova
[@wojtekmach]: https://github.com/wojtekmach
[@yordis]: https://github.com/yordis
Expand Down
1 change: 1 addition & 0 deletions USAGE.md
Expand Up @@ -17,6 +17,7 @@
<!-- E -->
<!-- F -->
- [Faker.File](lib/faker/file.ex)
- [Faker.Food](docs/food.md)
<!-- G -->
<!-- H -->
<!-- I -->
Expand Down
17 changes: 17 additions & 0 deletions docs/food.md
@@ -0,0 +1,17 @@
### Faker.Food

```elixir
Faker.Food.dish #=> "Barbecue Ribs"

Faker.Food.description #=> "Three eggs with cilantro"

Faker.Food.ingredient #=> "Albacore Tuna"

Faker.Food.measurement #=> "gallon"

Faker.Food.measurement_size #=> "1/4"

Faker.Food.metric_measurement #=> "liter"

Faker.Food.spice #=> "Cayenne Pepper"
```
61 changes: 61 additions & 0 deletions lib/faker/food.ex
@@ -0,0 +1,61 @@
defmodule Faker.Food do
@moduledoc """
Functions for generating food data
"""

@doc """
Returns a random complete dish
"""
@spec dish() :: String.t
def dish do
Module.concat(__MODULE__, Faker.mlocale).dish
end

@doc """
Returns a random description
"""
@spec description() :: String.t
def description do
Module.concat(__MODULE__, Faker.mlocale).description
end

@doc """
Returns a random ingredient
"""
@spec ingredient() :: String.t
def ingredient do
Module.concat(__MODULE__, Faker.mlocale).ingredient
end

@doc """
Returns a random spicy ingredient
"""
@spec spice() :: String.t
def spice do
Module.concat(__MODULE__, Faker.mlocale).spice
end

@doc """
Returns a random measurement
"""
@spec measurement() :: String.t
def measurement do
Module.concat(__MODULE__, Faker.mlocale).measurement
end

@doc """
Returns a random measurement size
"""
@spec measurement_size() :: String.t
def measurement_size do
Module.concat(__MODULE__, Faker.mlocale).measurement_size
end

@doc """
Returns a random metric measurement
"""
@spec metric_measurement() :: String.t
def metric_measurement do
Module.concat(__MODULE__, Faker.mlocale).metric_measurement
end
end
49 changes: 49 additions & 0 deletions lib/faker/food/en.ex
@@ -0,0 +1,49 @@
defmodule Faker.Food.En do
import Faker, only: [sampler: 2]

@moduledoc """
Functions for food data in English
"""

@doc """
Returns a dish
"""
@spec dish() :: String.t
sampler :dish, ["Barbecue Ribs", "Bruschette with Tomato", "Caesar Salad", "Califlower penne", "California maki", "Caprese Salad", "Cheeseburger", "Chicken Fajitas", "Chicken milanese", "Chicken wings", "Chilli con carne", "Ebiten maki", "Fettuccine Alfredo", "Fish and chips", "French fries with sausages", "Katsu Curry", "Lasagne", "Linguine with clams", "Meatballs with sauce", "Mushroom Risotto", "Pappardelle alla Bolognese", "Pasta Carbonara", "Pasta and Beans", "Pasta with Tomato and Basil", "Philadelphia maki", "Pizza", "Pork belly buns", "Pork sausage roll", "Ricotta stuffed Ravioli", "Risotto with seafood", "Salmon nigiri", "Scotch eggs", "Souvlaki", "Teriyaki Chicken donburi", "Tiramisù", "Tuna sashimi", "Vegetable Soup"]

@doc """
Returns a description
"""
@spec description() :: String.t
sampler :description, ["Three eggs with cilantro, tomatoes, onions, avocados and melted Emmental cheese. With a side of roasted potatoes, and your choice of toast or croissant.", "Three egg omelet with Roquefort cheese, chives, and ham. With a side of roasted potatoes, and your choice of toast or croissant.", "Three egg whites with spinach, mushrooms, caramelized onions, tomatoes and low-fat feta cheese. With herbed quinoa, and your choice of rye or whole-grain toast.", "Smoked salmon, poached eggs, diced red onions and Hollandaise sauce on an English muffin. With a side of roasted potatoes.", "Fresh parsley, Italian sausage, shallots, garlic, sun-dried tomatoes and mozzarella cheese in an all-butter crust. With a side of mixed fruits.", "Thick slices of French toast bread, brown sugar, half-and-half and vanilla, topped with powdered sugar. With two eggs served any style, and your choice of smoked bacon or smoked ham.", "Two buttermilk waffles, topped with whipped cream and maple syrup, a side of two eggs served any style, and your choice of smoked bacon or smoked ham.", "Breaded fried chicken with waffles, and a side of maple syrup.", "Two butter croissants of your choice (plain, almond or cheese). With a side of herb butter or house-made hazelnut spread.", "28-day aged 300g USDA Certified Prime Ribeye, rosemary-thyme garlic butter, with choice of two sides.", "Breaded fried chicken with waffles. Served with maple syrup.", "Fresh Norwegian salmon, lightly brushed with our herbed Dijon mustard sauce, with choice of two sides.", "Creamy mascarpone cheese and custard layered between espresso and rum soaked house-made ladyfingers, topped with Valrhona cocoa powder.", "Granny Smith apples mixed with brown sugar and butter filling, in a flaky all-butter crust, with ice cream."]

@doc """
Returns an ingredient
"""
@spec ingredient() :: String.t
sampler :ingredient, ["Achacha", "Adzuki Beans", "Agar", "Agave Syrup", "Ajowan Seed", "Albacore Tuna", "Alfalfa", "Allspice", "Almond oil", "Almonds", "Amaranth", "Amchur", "Anchovies", "Anchovies", "Aniseed", "Annatto seed", "Apple Cider Vinegar", "Apple juice", "Apple Juice Concentrate", "Apples", "Bonza", "Apples", "Apricots", "Arborio rice", "Arrowroot", "Artichoke", "Arugula", "Asafoetida", "Asian Greens", "Asian Noodles", "Asparagus", "Aubergine", "Avocado", "Avocado Oil", "Avocado Spread", "Bacon", "Baking Powder", "Baking Soda", "Balsamic Vinegar", "Bamboo Shoots", "Banana", "Barberry", "Barley", "Barramundi", "Basil Basmati rice", "Bay Leaves", "Bean Shoots", "Bean Sprouts", "Beans", "Green beans", "Beef", "Beetroot", "Berries", "Black Eyed Beans", "Blackberries", "Blood oranges", "Blue Cheese", "Blue Eye Trevalla", "Blue Swimmer Crab", "Blueberries", "Bocconcini", "Bok Choy", "Bonito Flakes", "Borlotti Beans", "Brazil Nut", "Bran", "Bread", "RyeBread", "Sour Dough Bread", "SpeltBread", "WhiteBread", "Wholegrain Bread", "Wholemeal", "Brie", "Broccoli", "Broccolini", "Brown Rice", "Brown rice vinegar", "Brussels Sprouts", "Buckwheat", "Buckwheat Noodles", "BulghurBurghul", "Bush Tomato", "Butter", "Butter Beans", "Buttermilk", "Butternut lettuce", "Butternut pumpkin", "Cabbage", "Cacao", "Cake", "Calamari", "Camellia Tea Oil", "Camembert", "Camomile", "Candle Nut", "Cannellini Beans", "Canola Oil", "Cantaloupe", "Capers", "Capsicum", "Starfruit", "Caraway Seed", "Cardamom", "CarobCarrot", "Carrot", "Cashews", "Cassia bark", "Cauliflower", "Cavalo", "Cayenne", "Celery", "Celery Seed", "Cheddar", "Cherries", "Cherries", "Chestnut", "Chestnut", "Chia seeds", "Chicken", "Chickory", "Chickpea", "Chilli Pepper", "FreshChillies", "dried Chinese Broccoli", "Chinese Cabbage", "Chinese Five Spice", "Chives", "Dark Chocolate", "MilkChocolate", "Choy Sum", "Cinnamon", "Clams", "Cloves", "Cocoa powder", "Coconut", "Coconut Oil", "Coconut water", "Coffee", "Corella Pear", "Coriander Leaves", "Coriander Seed", "Corn Oil", "Corn Syrup", "Corn Tortilla", "Cornichons", "Cornmeal", "Cos lettuce", "Cottage Cheese", "Cous Cous", "Crabs", "Cranberry", "Cream", "Cream Cheese", "Cucumber", "Cumin", "Cumquat", "Currants", "Curry Leaves", "Curry Powder", "Custard Apples", "Custard ApplesDaikon", "Dandelion", "Dashi", "Dates", "Dill", "Dragonfruit", "Dried Apricots", "Duck", "Edam", "Edamame", "Eggplant", "Eggs", "Elderberry", "Endive", "English Spinach", "Extra Virgin Olive Oil", "Farmed Prawns", "Feijoa", "Fennel", "Fennel Seeds", "Fenugreek", "Feta", "Figs", "File Powder", "Fingerlime", "Fish Sauce", "Flathead", "Flaxseed", "Flaxseed Oil", "Flounder", "Flour", "Besan", "Buckwheat Flour", "FlourOat", "FlourPotato", "FlourRice", "Brown Flour", "WhiteFlour", "SoyFlour", "Tapioca Flour", "UnbleachedFlour", "Wholewheat flour", "Freekeh", "French eschallots", "Fromage Blanc", "Fruit", "Galangal", "Garam Masala", "Garlic", "Garlic", "Chives", "GemGinger", "Goat Cheese", "Goat Milk", "Goji Berry", "Grape Seed Oil", "Grapefruit", "Grapes", "Green Chicken Curry", "Green Pepper", "Green Tea", "Green Tea noodles", "Greenwheat Freekeh", "Gruyere", "Guava", "Gula MelakaHaloumiHam", "Haricot Beans", "Harissa", "Hazelnut", "Hijiki", "Hiramasa Kingfish", "Hokkien Noodles", "Honey", "Honeydew melon", "Horseradish", "Hot smoked salmon", "Hummus", "Iceberg lettuce", "Incaberries", "Jarrahdale pumpkin", "Jasmine rice", "Jelly", "Jerusalem Artichoke", "Jewfish", "Jicama", "Juniper Berries", "Lime Leaves", "Kale", "Kangaroo", "Kecap Manis", "Kenchur", "Kidney Beans", "Kidneys", "Kiwi Fruit", "Kiwiberries", "Kohlrabi", "Kokam", "Kombu", "Koshihikari rice", "Kudzu", "Kumera", "Lamb", "Lavender Flowers", "Leeks", "Lemon", "Lemongrass", "Lentils", "Lettuce", "Licorice", "Limes", "Liver", "Lobster", "Longan", "Loquats", "Lotus Root", "Lychees", "Lychees", "Macadamia Nut", "Macadamia oil", "Mace", "Mackerel", "Mackerel", "Tinned", "Mahi mahi", "Mahlab", "Malt vinegar", "Mandarins", "Mango", "Mangosteens", "Maple Syrup", "Margarine", "Marigold", "Marjoram", "Mastic", "Melon", "Milk", "Mint", "Miso", "Molasses", "Monkfish", "Morwong", "Mountain Bread", "Mozzarella", "Muesli", "Mulberries", "Mullet", "Mung Beans", "Flat Mushrooms", "Brown Mushrooms", "Common Cultivated Mushrooms", "Enoki Mushrooms", "Oyster Mushrooms", "Shiitake Mushrooms" , "Mussels", "Mustard", "Mustard Seed", "Nashi Pear", "Nasturtium", "Nectarines", "Nori", "Nutmeg", "Nutritional Yeast", "Nuts", "Oatmeal", "Oats", "Octopus", "Okra", "Olive Oil", "Olives", "Omega Spread", "Onion", "Oranges", "Oregano", "Oyster Sauce", "Oysters", "Pear", "Pandanus leaves", "Papaw", "Papaya", "Paprik", "Parmesan cheese", "Parrotfish", "Parsley", "Parsnip", "Passionfruit", "Pasta", "Peaches", "Peanuts", "Pear Juice", "Pears", "Peas", "Pecan Nut", "Pecorino", "PepitasPepper", "Szechuan Pepperberry", "Peppercorns", "Peppermint", "Peppers", "Persimmon", "Pine Nut", "Pineapple", "Pinto Beans", "Pistachio Nut", "Plums", "Polenta", "Pomegranate", "Poppy Seed", "Porcini mushrooms", "Pork", "Potatoes", "Provolone", "Prunes", "Pumpkin", "Pumpkin Seed", "Purple carrot", "Purple RiceQuail", "Quark Quinc", "Quinoa", "Radicchio", "Radish", "Raisin", "Raspberry", "Red cabbage", "Red Lentils", "Red Pepper", "Red Wine Vinegar", "Redfish", "Rhubarb", "Rice Noodles", "Rice paper", "Rice Syrup", "Ricemilk", "Ricotta", "Rockmelon", "Rose Water", "Rosemary", "Rye", "Safflower Oil", "Saffron", "Sage", "Sake", "Salmon", "Sardines", "Sausages", "Scallops", "Sea Salt", "Semolina", "Sesame Oil", "Sesame seed", "Sesame Seeds", "Shark", "Silverbeet", "Slivered Almonds", "Smoked Trout", "Snapper", "Snowpea sprouts", "Snowpeas", "Soba", "Soy Beans", "Soy Milk", "Soy Sauce", "Soy", "Sprouts", "Soymilk", "Spearmint", "Spelt", "Spinach", "Spring Onions", "Squash", "Squid", "Star Anise", "Star Fruit", "Stevia", "Beef Stock", "Chicken Stock", "Fish Stock", "Vegetable Stock", "Strawberries", "Sugar", "Sultanas", "Sun dried tomatoes", "Sunflower Oil", "Sunflower Seeds", "SwedeSweet Chilli Sauce", "Sweet Potato", "Swiss Chard", "SwordfishTabasco", "Tahini", "Taleggio cheese", "Tamari", "Tamarillo", "Tangelo", "Tapioca", "Tarragon", "Tea", "Tea Oil", "Tempeh", "ThymeTofu", "Tom Yum", "Tomatoes", "Trout", "Tuna", "Turkey", "Turmeric", "Turnips", "Vanilla Beans", "Vegetable Oil", "Vegetable spaghetti", "Vermicelli Noodles", "Vinegar", "Wakame", "Walnut", "Warehou", "Wasabi", "Water", "Watercress", "Watermelon", "Wattleseed", "Wheat", "Wheatgrass juice", "White rice", "White wine vinegar", "Whiting Wild Rice", "William Pear", "RedWine", "White Wine", "Yeast", "Yellow Papaw", "Yellowtail Kingfish", "Yoghurt", "Yogurt", "Zucchini"]

@doc """
Returns a type of measurement
"""
@spec measurement() :: String.t
sampler :measurement, ["teaspoon", "tablespoon", "cup", "pint", "quart", "gallon"]

@doc """
Returns a measurement size
"""
@spec measurement_size() :: String.t
sampler :measurement_size, ["1/4", "1/3", "1/2", "1", "2", "3"]

@doc """
Returns a metric measurement
"""
@spec metric_measurement() :: String.t
sampler :metric_measurement, ["milliliter", "deciliter", "centiliter", "liter"]

@doc """
Returns a spicy ingredient
"""
@spec spice() :: String.t
sampler :spice, ["Achiote Seed", "Ajwain Seed", "Ajwan Seed", "Allspice Ground", "Allspice Whole", "Amchoor", "Anise", "Anise Star", "Aniseed Whole", "Annatto Seed", "Arrowroot", "Asafoetida", "Baharat", "Balti Masala", "Balti Stir Fry Mix", "Basil", "Bay Leaves", "Bay Leaves Chopped", "BBQ Seasoning", "Biryani Spice Mix", "Cajun Seasoning", "Caraway Seed", "Cardamom Ground", "Cardamom Whole", "Cassia", "Cassia Bark", "Cayenne Pepper", "Celery Leaf", "Celery Salt", "Celery Seed", "Chamomile", "Chervil", "Chicken Seasoning", "Chilli Crushed", "Chilli Ground", "Chilli Pepper", "Chillies Whole", "China Star", "Chinese 5 Spice", "Chives", "Cinnamon Bark", "Cinnamon Ground", "Cinnamon Powder", "Cinnamon Sticks", "Cloves Ground", "Cloves Whole", "Colombo Powder", "Coriander Ground", "Coriander Leaf", "Coriander Seed", "Creole Seasoning", "Cumin Ground", "Cumin Seed", "Cumin Seed Black", "Cumin Seed Royal", "Curly Leaf Parsley", "Curry Chinese", "Curry Hot", "Curry Leaves", "Curry Madras Medium", "Curry Mild", "Curry Thai Green", "Curry Thai Red", "Dhansak Spice Mix", "Dill Herb", "Dill Leaf", "Dill Seed", "Fajita Seasoning", "Fennel Seed", "Fenugreek Ground", "Fenugreek Leaf", "Fenugreek Seed", "Fines Herbes", "Fish Seasoning", "Five Spice Mix", "French Lavender", "Galangal Ground", "Garam Masala", "Garlic Chips", "Garlic Granules", "Garlic Powder", "Garlic Salt", "German Chamomile", "Ginger Root", "Ginger Ground", "Green Cardamom", "Herbes de Provence", "Jalfrezi Curry Powder", "Jalfrezi Mix", "Jerk Seasoning", "Juniper Berries", "Kaffir Leaves", "Korma Curry Powder", "Korma Mix", "Lamb Seasoning", "Lavender", "Lemon Grass", "Lemon Grass Chopped", "Lemon Pepper", "Lime Leaves", "Lime Leaves Ground", "Liquorice Root", "Mace Ground", "Mace Whole", "Mango Powder", "Marjoram", "Methi", "Methi Leaves", "Mexican Salsa Mix", "Mint", "Mixed Herbs", "Mixed Spice", "Mulled Cider Spices", "Mulled Wine Spices", "Mustard Powder", "Mustard Seed Black", "Mustard Seed Brown", "Mustard Seed White", "Mustard Seed Yellow", "Nigella", "Nutmeg Ground", "Nutmeg Whole", "Onion Seed", "Orange Zest", "Oregano", "Paella Seasoning", "Paprika", "Paprika Hungarian", "Paprika Smoked", "Parsley", "Parsley Flat Leaf", "Pepper Black Coarse", "Pepper Black Ground", "Pepper White Ground", "Peppercorns Black", "Peppercorns Cracked Black", "Peppercorns Green", "Peppercorns Mixed", "Peppercorns Pink", "Peppercorns Szechwan", "Peppercorns White", "Pickling Spice", "Pimento Berries", "Pimento Ground", "Piri Piri Seasoning", "Pizza Topping Mix", "Poppy Seed", "Pot Marjoram", "Poudre de Colombo", "Ras-el-Hanout", "Rice Paper", "Rogan Josh Curry Powder", "Rogan Josh Mix", "Rose Baie", "Rosemary", "Saffron", "Sage", "Sea Salt Coarse", "Seasoning Salt", "Self Adhesive Spice Labels", "Sesame Seed", "Spearmint", "Spice Charts", "Steak Seasoning", "Sumac Ground", "Sweet Basil", "Sweet Laurel", "Tagine Seasoning", "Tandoori Masala", "Tandoori Mix", "Tarragon", "Thai Creen Curry Mix", "Thai Red Curry Mix", "Thai Stir Fry", "Thyme", "Tikka Masala", "Tikka Masala Curry Powder", "Turmeric", "Turmeric Powder", "Vanilla Bean", "Vanilla Pods", "Vegetable Seasoning", "Zahtar Spice Mix"]
end
31 changes: 31 additions & 0 deletions test/faker/food_test.exs
@@ -0,0 +1,31 @@
defmodule FoodTest do
use ExUnit.Case, async: true

test "dish/0" do
assert is_binary(Faker.Food.dish)
end

test "description/0" do
assert is_binary(Faker.Food.description)
end

test "ingredient/0" do
assert is_binary(Faker.Food.ingredient)
end

test "spice/0" do
assert is_binary(Faker.Food.spice)
end

test "measurement/0" do
assert is_binary(Faker.Food.measurement)
end

test "measurement_size/0" do
assert is_binary(Faker.Food.measurement_size)
end

test "metric_measurement/0" do
assert is_binary(Faker.Food.metric_measurement)
end
end

0 comments on commit 13427ad

Please sign in to comment.