Browse code

Cpu mod: load options + testcase

Cinan Rakosnik authored on 16/12/2012 at 00:11:15
Showing 2 changed files
... ...
@@ -14,7 +14,7 @@ module Rubysermon
14 14
 		end
15 15
 
16 16
 		def load_options(options)
17
-
17
+			@options.merge!(options)
18 18
 		end
19 19
 
20 20
 		def results
... ...
@@ -18,4 +18,13 @@ class Cpu_test < MiniTest::Unit::TestCase
18 18
 	def test_cpu_load
19 19
 		assert_match(/^\d\.\d{2}$/, @cpu.results())
20 20
 	end
21
+
22
+	def test_notify?
23
+		@cpu.load_options({notify_threshold: 0})
24
+		assert_equal(true, @cpu.notify?)
25
+
26
+		#assume you have no more than 999 cpu load
27
+		@cpu.load_options({notify_threshold: 999})
28
+		assert_equal(false, @cpu.notify?)
29
+	end
21 30
 end
22 31
\ No newline at end of file