diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-11-27 09:54:26 +0000 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-11-27 09:54:26 +0000 |
commit | 29ba7950e799b3693d08b5f7913b62a76cc57f3d (patch) | |
tree | a5913af828574ecfdb0a338f70cf6d87d527da41 /test | |
parent | 939dc36052039e65a0af2936ffb1135281397eb2 (diff) |
Added tests to make sure validation works with History objects.
Diffstat (limited to 'test')
-rw-r--r-- | test/tc_mauve_history.rb | 7 |
1 files changed, 6 insertions, 1 deletions
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 <script>alert(\"arse\");</script>") - 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 |