Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Hobby to default #2341

Merged
merged 2 commits into from Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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

Available since version 2.18.0.

```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 2.18.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you convert this to next as documented in CONTRIBUTING.md (here and other places): https://github.com/faker-ruby/faker/blob/master/CONTRIBUTING.md

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