Monthly Archives: July 2010

rails3 and rspec2 view testing

Testing the view in Rspec is just great. It allows you to test the view in total isolation. It just does the render. Make sure you set up some data that is needed, and then check if all areas are available for instance. Now for Rspec2 a lot of things have changed: have_tag is no […]

rspec testing using macros

While this is short and DRY, a problem arises when one of the values in my look-up table does not behave as expected anymore. The complete test will fail, without having any clue which value caused it to fail. That is not good! But luckily, in rspec there exists the option to use macros. It […]

skipping slow tests in rspec2

For Test::Unit there is a module called skippy, that allows you to skip for instance slow tests. I was looking for a way to achieve the same in Rspec. I am currently developing against Rails 3.0.0.rc, and using rspec 2.0.0.beta.19 and could not find anything. So i asked on the rspec mailing list and got […]

Using git-submodule to handle plugins

Using git-submodule can make it very easy for you to work with plugins in your rails projects. I will try to show you this, in an easy step-by-step manner. To start, make a plugin-project, call it your_plugin, in its own folder, and push the code to git. Your standard commands apply, as for any project: […]

rewriting find_by_sql for rails 3

I am starting in Rails 3. I have a simple situation where i would select a parent based on a condition of one of its children. Normally i would write something like: Although this works, it is not the best solution to take. For one, it is vulnerable to sql-injection and secondly it shows a […]

installing ubuntu for ruby development

I have made the complete switch. My home development machine is no longer Windows XP, no longer dual booting Ubuntu but a full-fledged Ubuntu. After installing the dual-boot, and my machine at work this is the third time to install an ubuntu machine, and getting everything ready for ruby development. I just want to archive […]