Faker 1.0 released

10 September 2011

Earlier this week I released version 1.0 of the Faker gem. It's been about 4 years since the initial release of the gem, and the API has been fairly stable for the last couple of years, so I figured it was a good time to make the jump to 1.0. :)

This release finishes the conversion to I18n. Just about everything is in the locale files now, including the ability to define custom formats for everything -- company names, street addresses, etc. And, with the magic of method_missing, you can add new items to your locale file and have them show up as methods in the Faker classes.

The 1.0 release also settles some long-standing issues people have had with bad interaction between Faker, Rails 2.3, and locales (especially fallbacks). Though I'm not actively seeking to support Rails 2.3, I at least don't want it to be broken, so this release should cover that. Both Ruby 1.9.2 and 1.8.7 are fully supported.

Finally, I want to send out a big "thank you" to everyone (and there are a lot of them) who contributed code and ideas to this release. I really appreciate the interest shown and the work done by so many people who use and love Faker. According to rubygems.org, it has been installed over 400,000 times — over 1,000 times in the past few days!

Of course, I'm not done yet... next on the feature list is Faker::Image, which will provide an interface to all those cool fake image generator services out there. :)



Tesly Jr. Now Open Source

07 June 2007

A while ago I launched Tesly Jr. as a free hosted service for producing HTML reports for your automated Rails tests. A week or so before RailsConf I decided to open up the source to this simple little app, so now you can host your own version of Tesly Jr. Head on over to the Tesly Jr. site and download it from the link on the right-hand side of the page. Enjoy!



Finding bugs with irb

02 January 2007

There has been a "lot":http://tektastic.wordpress.com/2006/12/06/ruby-on-rails-how-to-load-session-objects-into-console/ of "irb":http://errtheblog.com/post/43 "love":http://slash7.com/articles/2006/12/21/secrets-of-the-rails-console-ninjas happening lately, and I'm lovin' the irb, too.

After launching a Rails e-commerce application recently, I was taking a look through the database just to make sure things were working as expected. Lo and behold, I found a problem. Something funky was happening with a small number of the orders. Time to dig in.

The problem centered around calculating discounts, which calculations can be affected by a number of variables present at the time of checkout: the particular items in the cart, the discount code used, etc. In other words, it would be somewhat difficult to work out what should have happened versus what actually happened by taking the relevant data and doing the calculations by hand. In this case, it would be much easier to actually poke at the transactions in question and play with the code as it would have interacted at the time of the transaction. Rails console to the rescue!

$ ./script/console >> irb Sale.find(:first, :conditions => "something's not quite right") >>

What's that you say? Invoking irb from inside irb? Madness! What does it do? It loads another session inside your current session, and now @self@ points to the results of that @Sale.find@. Why is this so useful? Well, suppose you have an instance method in the Sale class that does a lot of calculations, pulling in the related discount, related line items, etc., and it has references to @self.this@ and @self.that@ all over the place in there. With a little help from this irb sub-session, now you can play with that code as it was written, and (in this case) as it was executed against the instance when the instance was first created.

So, with this powerful tool in hand, and a little time poking at the discount calculations, I found my problem, wrote a test that reproduced it, fixed it, and repaired the affected transactions. Yay irb!



Test Case Results for Tesly Jr.

19 October 2006

I just pushed out a minor update Tesly Jr. that improves the navigation of test run results. Now instead of linking back to the test plan when viewing the details of a test run, the links take you to run-specific information for that test plan. In other words, you can now drill down to the result for each test case for all of your test run history.



Tesly Jr. Gets Email

11 October 2006

As requested on the Ruby Talk mailing list, you can now receive emails for failing test cases from Tesly Jr. If you specify on the Profile page that you'd like to receive email notifications, you will receive an email any time a test run includes a test plan that has a failing test case.

Now there is no excuse to not use Tesly Jr. for your continuous integration! :)