Displaying 1 result from an estimated 1 matches for "test_validate_title".
2006 Apr 28
1
Where to put localization strings
...a model that validates presence of the attribute title
class Entry < ActiveRecord::Base
validates_presence_of :title
:message => ''empty title is a no no''
end
I also have a test of this valitation.
class EntryTest < Test::Unit::TestCase
fixtures :entries
def test_validate_title
first = entries(1)
first.title = ''''
assert !first.save
assert_equal 1, first.errors.count
assert_equal ''empty title is a no no'', first.errors.on(:title)
end
end
The thing is I want to replace the hard coded message strings with a
constant....