Sha256: 93f77f66201d3cf0dc19398973b8b58d27c668a539b6cf85944dd388088c4103

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'minitest/autorun'

# I assume cat'ing to the LOAD path goes away when we're a real gem.
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
require 'nagios-herald'
require 'nagios-herald/config'

# Test the Config module.
class TestConfig < MiniTest::Unit::TestCase

  # Initial setup before we execute tests
  def setup
    @options = {}
    @options['config_file'] = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'etc', 'config.yml.example'))
    @options['message_type'] = "pager"
  end

  def teardown
  end

  # Make sure we can load the config and read values from it.
  # Read values from command-line options and the config file.
  def test_load_config
    NagiosHerald::Config.load(@options)
    assert_equal "pager", NagiosHerald::Config.config['message_type']                       # Command line
    assert_equal "ganglia.example.com", NagiosHerald::Config.config['servers']['ganglia']   # Config file
    assert_equal "splunkuser",  NagiosHerald::Config.config['splunk']['username']           # Config file
    assert_equal "http://logstash.example.com:9200",  NagiosHerald::Config.config['logstash']['url']           # Config file
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios-herald-0.0.4 test/unit/test_config.rb
nagios-herald-0.0.3 test/unit/test_config.rb
nagios-herald-0.0.2 test/unit/test_config.rb