Browse code

FIX: test error messages

Cinan Rakosnik authored on 16/12/2012 at 14:17:47
Showing 1 changed files
... ...
@@ -10,36 +10,48 @@ class Rubysermon_test < MiniTest::Unit::TestCase
10 10
 		ARGV[0] = "#{TEST_PATH}/fixtures/short_repeat_period.json"
11 11
 		app = Rubysermon::App.new
12 12
 
13
-		assert_raises(SystemExit) do
13
+		exception = assert_raises(SystemExit) do
14 14
 			app.run()
15 15
 		end
16
+
17
+		assert_equal("Repeat cycle is too short", exception.message)
16 18
 	end
17 19
 
18 20
 	def test_empty_modules
19 21
 		ARGV[0] = "#{TEST_PATH}/fixtures/empty_modules.json"
20 22
 		app = Rubysermon::App.new
21 23
 
22
-		assert_raises(SystemExit) do
24
+		exception = assert_raises(SystemExit) do
23 25
 			app.run()
24 26
 		end
27
+
28
+		assert_equal("There are no enabled modules", exception.message)
25 29
 	end
26 30
 
27 31
 	def test_empty_config1
28 32
 		ARGV[0] = "#{TEST_PATH}/fixtures/empty1.json"
29 33
 		app = Rubysermon::App.new
30 34
 
31
-		assert_raises(SystemExit) do
35
+		exception = assert_raises(SystemExit) do
32 36
 			app.run()
33 37
 		end
38
+
39
+		assert_equal("There are no enabled modules", exception.message)
34 40
 	end
35 41
 
36 42
 	def test_empty_config2
37 43
 		ARGV[0] = "#{TEST_PATH}/fixtures/empty2.json"
38 44
 		app = Rubysermon::App.new
39 45
 
40
-		assert_raises(SystemExit) do
41
-			app.run()
46
+
47
+		exception = ""
48
+		assert_output(nil, /Invalid JSON file/) do
49
+			exception = assert_raises(SystemExit) do
50
+				app.run()
51
+			end
42 52
 		end
53
+
54
+		assert_equal("There are no enabled modules", exception.message)
43 55
 	end
44 56
 
45 57
 	def test_wrong_config_path