Skip to content

Category Archives: Uncategorized

Bulk ammending commit messages in git

At my job I’m using git-p4 to work locally with some rails code in git and push to perforce. It’s working okay but one issue for me is that we require every commit to perforce to have a code review by someone, and we put the reviewer’s name at the bottom of each commit. For […]

updating embedded jruby gems with ant

Recently I have been using cuke4duke on a java project (which I’ll discuss in a later article). We have jruby running from jruby-lib/jruby-complete.jar. Our gems are embedded in the project with the GEM_HOME/GEM_PATH being set to jruby-lib/gems. All of this is under source control. We don’t have jruby installed at all on the system, it […]

Announcing Mainline

Mainline is a rails plugin which exposes your rails app via webrick to allow testing with browser automators such as Selenium or Watir. Mainline allows your rails actions to run in the same transaction as your unit tests so you can use fixtures, factories, or whatever. Basically you can now test selenium in your same […]

chicken and egg

I can’t believe this still hapens. Unzip software that is zipped. I was trying to unzip a file off of the web to install on my palm and they had zipped the 15k zip prc file to save those few extra bytes on the web making it impossible to actually download and use the software […]

testing named scopes

Named scopes are a nice feature that came out in rails 2.1, however, testing them is not very obvious. Say we have a named scope in our member object which looks like this: class Member < ActiveRecord::Base named_scope :active, {:conditions => {:status => Member::STATUS_ACTIVE}} end There are 2 things we need to do to test […]

Mysql issue with rails and antivirus on windows

abstract_adapter.rb:150:in log’: Mysql::Error: Can’t create/write to file ‘C:\MySQL5\tmp\#sql_190_0.MYI’ (Errcode: 13) I had been getting this issue quite a bit recently. The cause actually turned out to be a conflict between McAfee and MySQL. What was happening is that McAfee scans any file that is recently written to, especially those in tmp directories. McAfee reading the […]

testing protected and private methods in ruby

When I was looking for how to test protected an private methods in ruby on the net, I found many sites arguing whether you should, and several methods for doing so. I am of the opinion that if your method contains any logic at all, it should have a test. Some examples of what I […]

new has_a block

Pretty simple post, but any ruby object can be post conifged in a line with somthing like: => “tony”){|u|} which is great for active record tests. Or in a bigger example: @trip ={|t|!} @invite1 = => users(:aaron), :status => Invitation::STATUS_MAYBE){|i|} @invite1 = => users(:aaron), :status => Invitation::STATUS_MAYBE){|i|}