From a3e4e3a39738a0692732a3f2bc51f1ca5c8e3a70 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 28 Nov 2012 09:38:12 +0000 Subject: Finalised hack to validations such that they only occur when the object is dirty. --- test/tc_mauve_database_peculiarities.rb | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'test') diff --git a/test/tc_mauve_database_peculiarities.rb b/test/tc_mauve_database_peculiarities.rb index 58b73f3..fa21553 100644 --- a/test/tc_mauve_database_peculiarities.rb +++ b/test/tc_mauve_database_peculiarities.rb @@ -78,6 +78,63 @@ class TcMauveDatabasePostgresPeculiarities < TcMauveDatabasePeculiarities super (system("dropdb #{@temp_db}") || puts("Failed to drop #{@temp_db}")) if @temp_db end + + + def test_reminders_only_go_once + config=< 1 ) +} + +alert_group("default") { + notify("test1") { + during{ true } + every 1.minute + } +} +EOF + Configuration.current = ConfigurationBuilder.parse(config) + notification_buffer = Configuration.current.notification_methods["email"].deliver_to_queue + Server.instance.setup + + a = Alert.new( + :alert_id => "test", + :source => "test", + :subject => "test" + ) + + assert(a.raise!, "raise was not successful") + assert(a.saved?) + assert_equal(1, notification_buffer.length) + notification_buffer.pop + + 10.times do + Timecop.freeze(Time.now + 1.minute) + 5.times do + AlertChanged.all.each do |ac| + assert(ac.poll) + end + end + assert_equal(1, notification_buffer.length) + notification_buffer.pop + end + + end + + end class TcMauveDatabaseSqlite3Peculiarities < TcMauveDatabasePeculiarities -- cgit v1.2.3