Released my first RubyGem ‘BabyNames’

I often find myself always writing seed data and repeating myself.  Trying to make it as ‘real’ as possible instead of just “test1”, “test2”, “test3” etc.

So here is a gem that will simplify all of that! See babynames on github for more details or find it on rubygems.org

require ‘rubygems’
require ‘babynames’

person = BabyNames.person
person.first_name
=> Ilene
person.last_name
=> Brennan
person.male?
=> false
person.email
=> [email protected]

person = BabyNames.person
User.create(:first_name => person.first_name, :last_name => person.last_name, :email => person.email, :male => person.male?)

For more examples see the github readme

Posted on June 12, 2011 at 2:28 pm by Jordan Carter · Permalink
In: Ruby on Rails · Tagged with: ,

2 Responses

  1. Written by Kieran P
    on June 13, 2011 at 12:41 pm
    Permalink

    I would recommend not using actual email domains like hotmail, else tests might trigger emails to people who don’t want them 😉

    @example.com is the generally preferred one.

    Also, this looks similar in functionality to Faker, https://github.com/stympy/faker . Any benefit in BabyNames?

  2. Written by Jordan Carter
    on June 21, 2011 at 10:59 pm
    Permalink

    You make a valid point. Will update.

    Nope, no improvements yet. I didn’t know what to search for when I thought of the use case. It wasn’t until I looked where to categories the gem that I found the others. Also was good to learn how to publish a gem.

    I intend to make it more useful. It works for my needs at the moment :)

Leave a Reply