test/rubysermon_test.rb
def91ab1
 require_relative 'test_helper.rb'
 
 class Rubysermon_test < MiniTest::Unit::TestCase
 
e5c1300f
 	def teardown
 		ARGV.clear
71bcfce4
 	end
 
 	def test_wrong_refresh_time
e5c1300f
 		ARGV[0] = "#{TEST_PATH}/fixtures/short_repeat_period.json"
 		app = Rubysermon::App.new
71bcfce4
 
846fbf73
 		exception = assert_raises(SystemExit) do
e5c1300f
 			app.run()
71bcfce4
 		end
846fbf73
 
 		assert_equal("Repeat cycle is too short", exception.message)
71bcfce4
 	end
 
 	def test_empty_modules
e5c1300f
 		ARGV[0] = "#{TEST_PATH}/fixtures/empty_modules.json"
 		app = Rubysermon::App.new
71bcfce4
 
846fbf73
 		exception = assert_raises(SystemExit) do
e5c1300f
 			app.run()
71bcfce4
 		end
846fbf73
 
 		assert_equal("There are no enabled modules", exception.message)
71bcfce4
 	end
 
 	def test_empty_config1
e5c1300f
 		ARGV[0] = "#{TEST_PATH}/fixtures/empty1.json"
 		app = Rubysermon::App.new
71bcfce4
 
846fbf73
 		exception = assert_raises(SystemExit) do
e5c1300f
 			app.run()
71bcfce4
 		end
846fbf73
 
 		assert_equal("There are no enabled modules", exception.message)
71bcfce4
 	end
 
 	def test_empty_config2
e5c1300f
 		ARGV[0] = "#{TEST_PATH}/fixtures/empty2.json"
 		app = Rubysermon::App.new
71bcfce4
 
846fbf73
 
 		exception = ""
 		assert_output(nil, /Invalid JSON file/) do
 			exception = assert_raises(SystemExit) do
 				app.run()
 			end
71bcfce4
 		end
846fbf73
 
 		assert_equal("There are no enabled modules", exception.message)
71bcfce4
 	end
e5c1300f
 
 	def test_wrong_config_path
 		ARGV[0] = "/wrong_path"
 		exception = assert_raises(SystemExit) do
 			Rubysermon::App.new
 		end
 
 		assert_equal("Wrong config file path. Exiting.", exception.message)
 	end
def91ab1
 end