Kirjoitin taannoin kandidaatintyöni Ruby on Railsillä toteutettavasta www-sovelluksesta testauslähtöistä suunnittelua käyttäen. Oheen liitetystä kopiosta on korjattu muutama painovirhe. Työ on saatavilla vain suomeksi [PDF]. Read more »

(Pidin lyhyen esityksen aiheesta Tampereen Ruby-käyttäjien kokouksessa 29.11.07, ja siksi materiaali on suomeksi) Miksi? TDD suosittua Rails-projekteissa, yksikkötestit taas keskeisiä TDD:ssä Hyvien testien kirjoittaminen vaikeaa Yksikkötestit Millaisia ovat hyvät yksikkötestit? (as if I knew…) No ainakin ne ovat nopeita suorittaa riippumattomia muista... Read more »

Ok, it might be a tad early, but we did have our First Meeting last night and it was pretty awesome. We expected a total of four to five people according to quick e-mail exchange we had few days before the event,... Read more »

Unit test quickie

October 23rd, 2007

Having your unit tests isolated is something to strive for. Why? because ideally, when you (or someone else) introduces a bug to the system, only a single unit test would fail, thus leading you to the source of the error quickly. If... Read more »

I just wrote a simple unit test which indirectly resulted in calling create for the AR object. The problem is that I don’t want to create objects in my unit tests – in particular, I try to avoid hitting the database (or... Read more »

Plugin: colorized_test

July 29th, 2007

Plugin to colorize you Test::Unit output is available at svn://majakari.net/public/rails/plugins/colorized_test Tested with Linux & Windows (latter requires win32-console) Read more »

Plugin: active_mocks

July 29th, 2007

Initial revision of active_mocks is available from svn://majakari.net/public/rails/plugins/active_mocks Wrapper over flexmock, it helps you in mocking active record objects, especially those with associated data. Read more »

Robust migrations

July 27th, 2007

I often end up creating migrations which fail in the middle of setup, resulting in a well-known mess: you fix the bug, revert to previous version, re-migrate and realize that the table/column modification cannot be done because it has already been done... Read more »

All tests go green

July 18th, 2007

Many rails kiddies as well as pros alike have blogged something about colorizing your test results. However, few of the hacks seemed to work in Windows without requiring other gems or fiddlings. So here’s my simple solution which borrows heavily from Pat... Read more »

Every now and then I have to do something like this in my controllers: 1 2 3 4 5 6 7 8 9 10 11 12 13 class SomeItemController < ApplicationController ... def show begin @item = SomeItem.find(params[:id]) # do stuff with... Read more »

I often come into situation where I want to add a some content wrapped inside a container only if some condition is true, usually some item should be non-empty. For example, consider the following Rails view: 1 2 3 4 5 6... Read more »

W00t! To uphold my image of being a professional, I am forced to maintain my composure, visit bathroom later and 17.times { jump.frantically } there. I’m happy as a clam! My employer sent me to RailsConf ‘07 to learn what’s rad with... Read more »

Rails job board

May 7th, 2007

Not news for you rails afficionados, but Working with Rails is an excellent site for Rails developers seeking the jobs they love, as well as for companies who seek talented Ruby/Rails developers. There’s also a handy link you can put to your... Read more »

When debugging or inspecting Rails code, it is often nice to see just those methods that are added by rails or custom ActiveRecord object. This simple addition to ~/.irbrc does just that: if ENV['RAILS_ENV'] class Object protected def rails_meths; (public_methods - Object.public_instance_methods).sort;... Read more »

.tagcloud .weight-1 { font-size: 10px; } .tagcloud .weight-2 { font-size: 11px; } .tagcloud .weight-3 { font-size: 12px; } .tagcloud .weight-4 { font-size: 13px; }