From 29ba7950e799b3693d08b5f7913b62a76cc57f3d Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 27 Nov 2012 09:54:26 +0000 Subject: Added tests to make sure validation works with History objects. --- test/tc_mauve_history.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/tc_mauve_history.rb b/test/tc_mauve_history.rb index 62342f2..6b46b1d 100644 --- a/test/tc_mauve_history.rb +++ b/test/tc_mauve_history.rb @@ -25,9 +25,14 @@ class TcMauveHistory < Mauve::UnitTest # h = History.new(:alerts => [], :type => "note", :event => "Hello ") - h.save + assert(h.save) h.reload assert_equal("Hello ",h.event, "HTML not stripped correctly on save.") + + h = History.new(:alerts => [], :type => nil, :event => "Hello") + assert_raise(DataMapper::SaveFailureError, "History saved with blank type -- validation not working"){h.save} + assert_equal([:type], h.errors.keys, "Just the type field should be invalid") + end end -- cgit v1.2.1