Class: NagiosHerald::TestHelpers::BaseTestCase

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/nagios-herald/test_helpers/base_test_case.rb

Instance Method Summary collapse

Instance Method Details

#clear_envObject



74
75
76
77
78
79
# File 'lib/nagios-herald/test_helpers/base_test_case.rb', line 74

def clear_env
  # Load the env with empty strings
  NAGIOS_VARS.each do |k,_|
    ENV["NAGIOS_#{k}"] = ""
  end
end

#load_env(notification_type, expected_vars) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/nagios-herald/test_helpers/base_test_case.rb', line 62

def load_env(notification_type, expected_vars)
  # Load the env with the nagios var we want
  all_vars = NAGIOS_VARS
  all_vars[:NOTIFICATIONTYPE] = notification_type
  
  # Load all the new values
  expected_vars.each do |var|
    val = all_vars.fetch(var)
    ENV["NAGIOS_#{var}"] = val
  end
end

#simple_optionsObject



53
54
55
56
57
58
59
60
# File 'lib/nagios-herald/test_helpers/base_test_case.rb', line 53

def simple_options
  options = OpenStruct.new
  options.pager_mode = false
  options.noemail = false
  options.debug = false
  options.nagiosurl = 'http://test/nagios/'
  options
end