Archive for December, 2007

Prior to the introduction of nested example groups in RSpec, I’d always felt that descriptions got a little unwieldy when trying to describe the different cases and disliked specifying the controller_name repeatedly. For example (and these are real examples from real projects at work, with actual code removed for conciseness):
describe ‘POST HotelDealsController#create with a valid [...]

That’s right, Don’t Repeat Yourself in your functional and ActionMailer tests. If you’re a Test::Unit user, this will probably look familiar to you when writing Rails functional tests (for your controllers):
class PostsControllerTest < Test::Unit::TestCase
def setup
@controller = PostsController.new
@request = ActionController::TestRequest.new
[...]

Just in the nick of time for the Christmas target, the Ruby core team has released Ruby 1.9.0 – Matz announced the release on the ruby-talk mailing list not too long ago.
Rubygem and Ruby library developers, now’s the time to get down to making your Ruby code compatible with 1.9.0.
Rails is not too far from [...]

You may not have noticed this yet, but Rails 2.0 has a new convenient syntax for generating ActiveRecord migrations. Go ahead, run the migration generator with script/generate migration. I’ll wait.
Yup, you can now specify the columns you want to add in your migration by passing attribute/type pairs to the migration generator. Ergo,
script/generate migration AddMoreToAnime episodes:integer [...]

In case anyone is wondering about the pause in Rails 2.0 – a feature a day posts, yes, I know, I’ve not been writing any posts for a week or so. I’ll be posting more actively again from tomorrow – just taking a short break due to general lethargy these few days. And submitting patches [...]