Skip to content

Commit

Permalink
Add Faker::Cannabis class (faker-ruby#987)
Browse files Browse the repository at this point in the history
Add Faker::Cannabis class
  • Loading branch information
bpleslie authored and vbrazo committed May 21, 2018
1 parent 69f4c34 commit d3eaaee
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

**Additions**

- [PR #987](https://github.com/stympy/faker/pull/987) Add Faker::Cannabis class [@GhostGroup](https://github.com/GhostGroup)
- [PR #1236](https://github.com/stympy/faker/pull/1236) Updates dessert faker [@susiirwin](https://github.com/susiirwin)
- [PR #1146](https://github.com/stympy/faker/pull/1146) Update company docs [@PuZZleDucK](https://github.com/PuZZleDucK)
- [PR #1199](https://github.com/stympy/faker/pull/1199) Add Faker::StrangerThings [@Connerh92](https://github.com/Connerh92)
- [PR #1125](https://github.com/stympy/faker/pull/1125) Added Faker::Community ([geoffhull03](https://github.com/geoffhull03))
- [PR #1129](https://github.com/stympy/faker/pull/1129) Added SingularSiegler quotes ([splashinn](https://github.com/splashinn))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Contents
- [Faker::Boolean](doc/boolean.md)
- [Faker::BossaNova](doc/bossa_nova.md)
- [Faker::Business](doc/business.md)
- [Faker::Cannabis](doc/cannabis.md)
- [Faker::Cat](doc/cat.md)
- [Faker::ChuckNorris](doc/chuck_norris.md)
- [Faker::Code](doc/code.md)
Expand Down
35 changes: 35 additions & 0 deletions doc/cannabis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Faker::Cannabis

Available since version 1.8.0.

```ruby
# Random strain
Faker::Cannabis.strain #=> "24k"

# Random cannabinoid_abbreviation
Faker::Cannabis.cannabinoid_abbreviation #=> "THC"

# Random cannabinoid
Faker::Cannabis.cannabinoid #=> "Tetrahydrocannabinol"

# Random terpene
Faker::Cannabis.terpene #=> "α Pinene"

# Random medical_use
Faker::Cannabis.medical_use #=> "analgesic"

# Random health_benefit
Faker::Cannabis.health_benefit #=> "relieves pain"

# Random category
Faker::Cannabis.category #=> "capsules"

# Random type
Faker::Cannabis.type #=> "hybrid"

# Random buzzword
Faker::Cannabis.buzzword #=> "blunt wrap"

# Random website
Faker::Cannabis.website #=> "https://weedmaps.com"
```
45 changes: 45 additions & 0 deletions lib/faker/cannabis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

module Faker
class Cannabis < Base
def self.strain
fetch('cannabis.strains')
end

def self.cannabinoid_abbreviation
fetch('cannabis.cannabinoid_abbreviations')
end

def self.cannabinoid
fetch('cannabis.cannabinoids')
end

def self.terpene
fetch('cannabis.terpenes')
end

def self.medical_use
fetch('cannabis.medical_uses')
end

def self.health_benefit
fetch('cannabis.health_benefits')
end

def self.category
fetch('cannabis.categories')
end

def self.type
fetch('cannabis.types')
end

def self.buzzword
fetch('cannabis.buzzwords')
end

def self.website
fetch('cannabis.websites')
end
end
end
13 changes: 13 additions & 0 deletions lib/locales/en/cannabis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
en:
faker:
cannabis:
strains: ["24k", "Alien Diesel", "Banana OG", "Bio-Diesel", "Black Diamond OG", "Black Jack", "Blackberry Cookies", "Blackberry Soda", "Blackwater OG", "Blue Dream", "Blueberry Tangie", "Boss Hog", "Cali Mist", "Candy Skunk", "Candyland", "Canna Sutra", "Cheese", "Chem Berry", "Cherry Cheese", "Cherry Lime", "Chocolate Hashberry", "Chronic", "Church OG", "Clementine", "Colfax Cookies", "Colfax Jack", "Colfax Platinum", "Critical Kush", "Diablo OG", "Double Dutch Bus", "Dutch Treat", "Forbidden Fruit", "Gelato", "Ghost OG", "Girl Scout Cookies", "Godzilla Glue", "Golden Strawberries", "Gorilla Glue", "Gorilla Princess", "Granddaddy Purple Kush", "Grapefruit Kush", "Green Cobra", "Green Queen", "Hardcore Grapes", "Heavy OG", "Jack Frost", "Key Lime Pie", "King Kong OG", "King Louis OG", "Kings Reserve OG", "Koffee Cake", "Lemon Jack", "Lemon Meringue", "Lemon Skunk", "Lemonade", "Lime #5", "Lucky Charms", "Master OG", "Maui Jack", "Mendo Breath", "Mojito", "Moon Glue", "Mr. Nice Guy", "NY Sour Diesel", "Nectarine", "Novicane Kush", "Nug Salad", "OG Chem", "OG Salad", "ONAC OG", "Panama Punch", "Pineapple Sage", "Pinesol OG", "Pink Lotus", "Pitbull", "Platinum OG", "Presidential OG", "Private Reserve", "Purple Punch", "Queen Dream", "Rainbow Sherbet", "Raskal OG", "Redwood Bubba Kush", "Rude Boi OG", "Satellite OG", "Saturn OG", "Sherbert", "Skywalker OG", "Snozzberry OG", "Sonoma Glue", "Soul Assasin OG", "Soul Assassin", "Sour Cheese", "Strawberry Banana", "Strawberry Cough", "Strawberry Moonrocks", "Strawberry Shortcake", "Sugar Momma", "Sunset Sherbert", "Super Glue", "Super Jack", "Super Silver Haze", "Tangie", "Watermelon", "White Tahoe Cookies", "Whitewalker OG", "XJ-13"]
cannabinoid_abbreviations: ["THC", "THCa", "∆9THC", "∆8THC", "THCv", "THCv", "CBD", "CBDa", "CBDv", "CBN", "CBNa", "CBG", "CBGa", "CBC", "CBCa", "CBL", "CBLa"]
cannabinoids: ["Tetrahydrocannabinol", "Tetrahydrocannabinolic Acid", "Tetrahydrocannabivarin", "Cannabidiol", "Cannabidiolic Acid", "Cannabidivarin", "Cannabinol", "Cannabinolic Acid", "Cannabigerol", "Cannabigerolic Acid", "Cannabichromene", "Cannabichromic Acid", "Cannabicyclol", "Cannabicyclic Acid"]
terpenes: ["α Pinene", "Myrcene", "α Phellandrene", "∆ 3 Carene", "Terpinene", "Limonene", "α Terpinolene", "Linalool", "Fenchol", "Borneol", "Terpineol", "Geraniol", "α Humulene", "β Caryophyllene", "Caryophyllene Oxide", "α Bisabolol", "Camphene", "β Pinene", "Ocimene", "Sabinene", "Camphor", "Isoborneol", "Menthol", "α Cedrene", "Nerolidol", "R-(+)-Pulegone", "Eucalyptol", "p-Cymene", "(-)-Isopulegol", "Geranyl", "Acetate", "Guaiol", "Valencene", "Phytol", "Citronellol"]
medical_uses: ["analgesic", "anti-bacterial", "anti-diabetic", "anti-emetic", "anti-epileptic", "anti-fungal", "anti-depressant", "anti-inflammatory", "anti-insomnia", "anti-ischemic", "anti-cancer", "anti-psoriatic", "anti-psychotic", "anti-spasmodic", "anti-anxiety", "appetite stimulant", "anorectic", "bone stimulant", "immunoregulation", "immunostimulant", "intestinal anti-prokinetic", "neuroprotective", "bronchodilator", "anti-stress", "anti-septic", "psychoactive", "non-psychoactive", "decongestant", "anti-histamine", "anti-oxidant", "anti-viral"]
health_benefits: ["relieves pain", "kills or slows bacteria growth", "reduces blood sugar levels", "reduces vomiting and nausea", "reduces seizures and convulsion", "treats fungal infection", "treats depression", "reduces inflammation", "aids sleep", "reduces risk of artery blockage", "inhibits cell growth in tumors/cancer cells", "treats psoriasis", "tranquilizing", "suppresses muscle spasms", "relieves anxiety", "stimulates appetite", "suppresses appetite", "promotes bone growth", "regulates function in the immune system", "stimulates function in the immune system", "reduces contractions in the small intestines", "protects against nervous system degeneration", "improves airflow to lungs", "prevents stress", "prevents infection", "affects mental activity", "does not affect mental activity", "relieves congestion", "treats allergy symptoms", "cell protectant", "treats viral infections"]
categories: ["capsules", "concentrates", "crumble", "crystalline", "distillate", "edibles", "flower", "ice hash", "live resin", "medical", "rosin", "seeds & clones", "shatter", "tinctures", "topicals", "vape pens"]
types: ["hybrid", "indica", "sativa"]
buzzwords: ["blunt wrap", "bong", "bottom shelf", "bubbler", "cashed", "cbd", "dank", "eighth", "gram", "high", "hydroponic", "keef", "marijuana", "mary jane", "munchies", "ounce", "papers", "pipe", "pound", "private reserve", "ripped", "spliff", "stoned", "terpene", "thc", "toke", "top shelf", "wake and bake", "weed"]
websites: ["https://weedmaps.com"]
65 changes: 65 additions & 0 deletions test/test_faker_cannabis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# frozen_string_literal: true

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

class TestFakerCannabis < Test::Unit::TestCase
def setup
Faker::Config.locale = nil
end

def test_strain
10.times { assert Faker::Cannabis.strain.match(/[\w]+/) }
end

def test_cannabinoid_abbreviation
10.times { assert Faker::Cannabis.cannabinoid_abbreviation.match(/[\w]+/) }
end

def test_cannabinoid
10.times { assert Faker::Cannabis.cannabinoid.match(/[\w]+/) }
end

def test_terpene
10.times { assert Faker::Cannabis.terpene.match(/[\w]+/) }
end

def test_medical_use
10.times { assert Faker::Cannabis.medical_use.match(/[\w]+/) }
end

def test_health_benefit
10.times { assert Faker::Cannabis.health_benefit.match(/[\w]+/) }
end

def test_category
10.times { assert Faker::Cannabis.category.match(/[\w]+/) }
end

def test_type
10.times { assert Faker::Cannabis.type.match(/[\w]+/) }
end

def test_buzzword
10.times { assert Faker::Cannabis.buzzword.match(/[\w]+/) }
end

def test_website
10.times { assert Faker::Cannabis.website.match(/[\w]+/) }
end

def test_locales
[nil, 'en', 'de'].each do |_locale_name|
Faker::Config.locale = 'de'
assert Faker::Cannabis.strain.is_a? String
assert Faker::Cannabis.cannabinoid_abbreviation.is_a? String
assert Faker::Cannabis.cannabinoid.is_a? String
assert Faker::Cannabis.terpene.is_a? String
assert Faker::Cannabis.medical_use.is_a? String
assert Faker::Cannabis.health_benefit.is_a? String
assert Faker::Cannabis.category.is_a? String
assert Faker::Cannabis.type.is_a? String
assert Faker::Cannabis.buzzword.is_a? String
assert Faker::Cannabis.website.is_a? String
end
end
end

0 comments on commit d3eaaee

Please sign in to comment.