Sha256: 3faf386c8043c749ce0e4b7fac0007d9b34045974ded148a45ef5a572346e78c

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2009-2010, Sebastian Staudt

require 'test_helper'

class TestConfig < Test::Unit::TestCase

  context 'A configuration' do

    setup do
      path = File.join(File.dirname(__FILE__), 'config')
      @config_file = 'config.yml'
      @search_paths = []
      @search_paths << File.join(path, '0')
      @search_paths << File.join(path, '1')
      @search_paths << File.join(path, '2')
      @search_paths << File.join(path, '3')

      @factory = Rubikon::Config::Factory.new(@config_file, @search_paths)
    end

    should 'search multiple paths for a configuration file' do
      config_files = @search_paths[0..-2].map { |p| File.join(p, @config_file) }
      assert_equal config_files, @factory.files
    end

    should 'read the configuration from the specified files' do
      config = {
        :value     => 0,
        :value1    => 1,
        :value2    => 2,
        :overriden => 2
      }
      assert_equal config, @factory.config
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubikon-0.5.3 test/test_config.rb
rubikon-0.5.2 test/test_config.rb
rubikon-0.5.1 test/test_config.rb
rubikon-0.5.0 test/test_config.rb