Skip to content

Commit

Permalink
add Hobby to default (#2341)
Browse files Browse the repository at this point in the history
* add Hobby to default

* add # @faker.version per request
  • Loading branch information
rohanphillips committed Jun 29, 2021
1 parent 3afbb93 commit cbe6017
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -172,6 +172,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
- [Faker::GreekPhilosophers](doc/default/greek_philosophers.md)
- [Faker::Hacker](doc/default/hacker.md)
- [Faker::Hipster](doc/default/hipster.md)
- [Faker::Hobby](doc/default/hobby.md
- [Faker::House](doc/default/house.md)
- [Faker::IDNumber](doc/default/id_number.md)
- [Faker::IndustrySegments](doc/default/industry_segments.md)
Expand Down
6 changes: 6 additions & 0 deletions doc/default/hobby.md
@@ -0,0 +1,6 @@
# Faker::Food

# @faker.version next

```ruby
Faker::Hobby.activity #=> "Cooking"
22 changes: 22 additions & 0 deletions lib/faker/default/hobby.rb
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Faker
class Hobby < Base
flexible :hobby

class << self
##
# Retrieves a typical hobby activity.
#
# @return [String]
#
# @example
# Faker::Hobby.activity #=> "Cooking"
#
# @faker.version next
def activity
fetch('hobby.activity')
end
end
end
end
171 changes: 171 additions & 0 deletions lib/locales/en/hobby.yml
@@ -0,0 +1,171 @@
en:
faker:
hobby:
activity:
- 3D printing
- amateur radio
- scrapbook
- Amateur radio
- Acting
- Baton twirling
- Board games
- Book restoration
- Cabaret
- Calligraphy
- Candle making
- Computer programming
- Coffee roasting
- Cooking
- Coloring
- Cosplaying
- Couponing
- Creative writing
- Crocheting
- Cryptography
- Dance
- Digital arts
- Drama
- Drawing
- Do it yourself
- Electronics
- Embroidery
- Fashion
- Flower arranging
- Foreign language learning
- Gaming
- tabletop games
- role-playing games
- Gambling
- Genealogy
- Glassblowing
- Gunsmithing
- Homebrewing
- Ice skating
- Jewelry making
- Jigsaw puzzles
- Juggling
- Knapping
- Knitting
- Kabaddi
- Knife making
- Lacemaking
- Lapidary
- Leather crafting
- Lego building
- Lockpicking
- Machining
- Macrame
- Metalworking
- Magic
- Model building
- Listening to music
- Origami
- Painting
- Playing musical instruments
- Pet
- Poi
- Pottery
- Puzzles
- Quilting
- Reading
- Scrapbooking
- Sculpting
- Sewing
- Singing
- Sketching
- Soapmaking
- Sports
- Stand-up comedy
- Sudoku
- Table tennis
- Taxidermy
- Video gaming
- Watching movies
- Web surfing
- Whittling
- Wood carving
- Woodworking
- Worldbuilding
- Writing
- Yoga
- Yo-yoing
- Air sports
- Archery
- Astronomy
- Backpacking
- BASE jumping
- Baseball
- Basketball
- Beekeeping
- Bird watching
- Blacksmithing
- Board sports
- Bodybuilding
- Brazilian jiu-jitsu
- Community
- Cycling
- Dowsing
- Driving
- Fishing
- Flag Football
- Flying
- Flying disc
- Foraging
- Gardening
- Geocaching
- Ghost hunting
- Graffiti
- Handball
- Hiking
- Hooping
- Horseback riding
- Hunting
- Inline skating
- Jogging
- Kayaking
- Kite flying
- Kitesurfing
- LARPing
- Letterboxing
- Metal detecting
- Motor sports
- Mountain biking
- Mountaineering
- Mushroom hunting
- Mycology
- Netball
- Nordic skating
- Orienteering
- Paintball
- Parkour
- Photography
- Polo
- Rafting
- Rappelling
- Rock climbing
- Roller skating
- Rugby
- Running
- Sailing
- Sand art
- Scouting
- Scuba diving
- Sculling
- Rowing
- Shooting
- Shopping
- Skateboarding
- Skiing
- Skimboarding
- Skydiving
- Slacklining
- Snowboarding
- Stone skipping
- Surfing
- Swimming
- Taekwondo
- Tai chi
- Urban exploration
- Vacation
- Vehicle restoration
- Water sports
19 changes: 19 additions & 0 deletions test/faker/default/test_faker_hobby.rb
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require_relative '../../test_helper'

class TestFakerHobby < Test::Unit::TestCase
def setup
@tester = Faker::Hobby
end

def test_flexible_key
flexible_key = @tester.instance_variable_get('@flexible_key')

assert flexible_key == :hobby
end

def test_activity
assert @tester.activity.match(/\w+/)
end
end

0 comments on commit cbe6017

Please sign in to comment.