diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-05-08 14:21:45 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2012-05-08 14:21:45 +0100 |
commit | 6b5646f70b1c14eadeb9778f93e078338f45f3f4 (patch) | |
tree | 7479ab98182e9c27d0ced71f03e5f10e25568a30 /test | |
parent | 75965bd39036705cf20ad205a712c47c56261d76 (diff) |
Changed destroy! to destroy everywhere to ensure Histories are deleted
correctly. Added test.
Diffstat (limited to 'test')
-rw-r--r-- | test/tc_mauve_alert.rb | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/test/tc_mauve_alert.rb b/test/tc_mauve_alert.rb index 3af9075..269bf4c 100644 --- a/test/tc_mauve_alert.rb +++ b/test/tc_mauve_alert.rb @@ -38,10 +38,6 @@ EOF super end - def test_alert_group - - end - # # This is also the test for in_source_list? @@ -292,4 +288,31 @@ EOF end + def test_destroy_history_on_destroy + Configuration.current = ConfigurationBuilder.parse(@test_config) + Server.instance.setup + + alert = Alert.new( + :alert_id => "test_no_notification_for_old_alerts", + :source => "test", + :subject => "test" + ) + alert.save + alert.raise! + alert.reload + assert_equal(1, History.all.length) + + + Timecop.freeze(Time.now + 5.minutes) + alert.clear! + assert_equal(2, History.all.length) + + # + # OK now we destroy the alert. Destory the histories too. + # + alert.destroy + assert_equal(0, History.all.length) + + end + end |