how to do unit test whic allows null in the column

Hi Jay,

I quite like this way of working its nice and clean and each test demonstrates exactly what you expect to be invalid and why

def setup   @va.lid_attributes = {     :parents => 1     :children => 1,     :family_clam => 1,     :campsite => 'blah',     :total => 100,   } end

def test_valid   cart = Cart.create(@valid_attributes)   assert cart.valid? end

def test_valid_if_children_is_nil   cart = Cart.create(@valid_attributes.merge(:children => nil)   assert cart.valid?   # or   assert cart.errors.on(:children).nil? end

def test_invalid_if_total_is_nil   cart = Cart.create(@valid_attributes.merge(:total => nil)   assert ! cart.valid?   assert cart.errors.on(:total) end

I hope this helps.

RobL

Jay Pangmi wrote:

I hope this helps.

RobL

Thanks RobL. It sure did help..