I was a little surprised that Rails offers assert_valid but not its implied converse, assert_not_valid … so I wrote it:

def assert_not_valid(record, message='expected not to be valid, but was valid')
    clean_backtrace do
      assert !record.valid?, message
    end
  end


blog comments powered by Disqus

Published

02 October 2007

Categories

ruby/rails testing