Sha256: 04bd7152bf53c985eb7b82f495297973e89038109d128da8fb0614a9df87daee

Contents?: true

Size: 1.4 KB

Versions: 59

Compression:

Stored size: 1.4 KB

Contents

require "yaml"

require "log4r"

module Acceptance
  # This represents a configuration object for acceptance tests.
  class Config
    attr_reader :vagrant_path
    attr_reader :vagrant_version
    attr_reader :env
    attr_reader :box_directory

    def initialize(path)
      @logger = Log4r::Logger.new("test::acceptance::config")
      @logger.info("Loading configuration from: #{path}")
      options = YAML.load_file(path)
      @logger.info("Loaded: #{options.inspect}")

      @vagrant_path    = options["vagrant_path"]
      @vagrant_version = options["vagrant_version"]
      @env             = options["env"]
      @box_directory   = options["box_directory"]

      # Verify the configuration object.
      validate
    end

    # This method verifies the configuration and makes sure that
    # all the configuration is available and appears good. This
    # method will raise an ArgumentError in the case that anything
    # is wrong.
    def validate
      if !@vagrant_path || !File.file?(@vagrant_path)
        raise ArgumentError, "'vagrant_path' must point to the `vagrant` executable"
      elsif !@vagrant_version
        raise ArgumentError, "`vagrant_version' must be set to the version of the `vagrant` executable"
      elsif !@box_directory || !File.directory?(@box_directory)
        raise ArgumentError, "`box_directory` must be set to a folder containing boxes for the tests."
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 11 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/config.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/config.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/config.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/support/config.rb
bmhatfield-vagrant-1.0.10 test/acceptance/support/config.rb
bmhatfield-vagrant-1.0.9 test/acceptance/support/config.rb
tnargav-1.3.6 test/acceptance/support/config.rb
tnargav-1.3.3 test/acceptance/support/config.rb
bmhatfield-vagrant-1.0.8 test/acceptance/support/config.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/support/config.rb
tnargav-1.2.3 test/acceptance/support/config.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/support/config.rb
bmhatfield-vagrant-1.0.7 test/acceptance/support/config.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/support/config.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/support/config.rb
tnargav-1.2.2 test/acceptance/support/config.rb
vagrantup-1.1.3 test/acceptance/support/config.rb
vagrantup-1.1.2 test/acceptance/support/config.rb
vagrantup-1.1.1 test/acceptance/support/config.rb
vagrantup-1.1.0 test/acceptance/support/config.rb