Week 4, Friday

April 17, 2009 at 7:47 pm (Ruby, Week 4) (, , , )

Jake Scruggs and I started the day out by changing the feature I did yesterday so that emails would only be sent for 500 errors, not 404’s. This way people’s inboxes won’t be clogged with notifications when any old bot hits the wrong URL – or tries to hack it! It’s a good fix to begin with, but Jake also helped me to think through a refactoring that really cleaned things up. I was overriding the rescue_action_in_public method from the exception_notification plugin, and now that we needed it to act almost like the default, we had almost an exact copy of that method from the plugin. There’s an if-else statement that separates 404 errors from others, and the plugin, by default, calls its render_404 method and render_500 method, respectively. The obvious solution (well, obvious after the fact, anyway), was to instead override render_404 and render_500 to simply call our new method, render_error (which uses the Rails layout code to keep some consistency across the site). Much nicer, much cleaner. Thanks, Jake!

Eric and I finally got our continuous integration server up and running for the site, which was kind of an adventure. Note to self: use rake features, not cucumber features -n. CruiseControl.rb interprets the rake tasks better than command line output – or at least the setup is more intuitive that way. CruiseControl.rb, by the way, is pretty awesome: it’s a Rails app that monitors your Subversion repository and runs scripts of your choice, emailing build failures as desired. I can imagine a similar setup using Ant tasks for Java, and it looks like there’s a Cruise Control for that, too.

Eric and I started a small bug list as well, and knocked out several of those before we finished for the day (several styling things, and one or two things we didn’t consider when building stories). I’m definitely feeling much more comfortable in RSpec now: I wrote some helper tests after everyone else left for the day, and I knew exactly what I needed to do, in a strict TDD/BDD manner. I went pretty slowly, and because of my tests, and our already extensive unit and integration test suite, I’m pretty confident of the correctness of my implementation code (of course, I also checked manually to make sure I didn’t do anything stupid that I forgot to test). It’s nice not to feel overwhelmed by RSpec anymore. I still want to get the new RSpec book, but I’m feeling less and less that I absolutely MUST read it as I learn more on the job.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: