Friday, July 23, 2010

Last Entry

As u should have noticed, this blog has not been updated for a LONG LONG time, and i'm now going to officially declare END-OF-LIFE for it. If u are interested in following my technical musings, do drop by my other blog tyenglog to take a look.

Cheers & stay happy !!

Friday, February 13, 2009

Heading Back SG Soon

it has been quite sometime since i last blogged, guess blogging just hasn't become a habit yet. anyway, today's entry is just to announce that i'm kicking :P

btw, have been quite busy lately, as we are heading back sg (for good) very soon, before end of feb 09. it has been 2yrs since i last got back ... things must have changed quite abit (heard from my friend that the land is getting damn crowded), yet there are probably still alot that haven't changed (it still takes a long time to get a reply for an email to a civil service).

anything i missed back in sg? yup, i missed my parents plus the swimming pool just down my hdb. oh yes, and the annual free for all jap film fest !!

(written on my mobile)

Thursday, January 15, 2009

dm_skinny_specs ... trimming the fat from dm models' specs

Just released my 2nd gem dm_skinny_specs last night, this gem aims to help u trim away extra fat from dm models' specs. Here's a quick example of how things work (for 0.1.0):

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'dm_skinny_spec'

class User
include DataMapper::Resource

property :id, Serial
property :name, String, :auto_validation => false
property :email, String, :auto_validation => false

validates_length :name, :min => 5
validates_format :email, :as => :email_address, :allow_nil => false
end

User.fix {{
:name => /\w{5,10}/.gen,
:email => /\w{10}/.gen + '@fmail.com',
}}

describe User do

before do
User.auto_migrate!
@instances = {}
end

# This MUST be provided since we do not mandate u to use any specific fixture
# utility.
def instance(id=:default)
@instances[id] ||= User.gen
end

it_should_validate_length :name, :min => 5
it_should_validate_format :email, :as => :email_address, :allow_nil => false

end


Hey !! Wait a minute, doesn't skinny_spec and the whole idea of these spec helpers sound familiar ?! Ok Ok, i admit it, i was inspired by the original skinny_spec for rails :P