Class: VagrantTest::Config

Inherits:
Vagrant::Config::Base
  • Object
show all
Defined in:
lib/vagrant-test/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject



7
8
9
# File 'lib/vagrant-test/config.rb', line 7

def command
  @command || DEFAULT_COMMAND
end

#dirObject



11
12
13
# File 'lib/vagrant-test/config.rb', line 11

def dir
  @dir || DEFAULT_DIR
end

#external_testsObject



19
20
21
# File 'lib/vagrant-test/config.rb', line 19

def external_tests
  @external_tests || []
end

#internal_testsObject



15
16
17
# File 'lib/vagrant-test/config.rb', line 15

def internal_tests
  @internal_tests || []
end

Instance Method Details

#validate(env, errors) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vagrant-test/config.rb', line 23

def validate(env, errors)
  errors.add("Test directory not found: #{dir}") unless File.directory?(dir)
  [:internal_tests, :external_tests].inject({}) { |memo,obj|
    memo.merge({ obj => send(obj.to_sym) })
  }.each do |name,value|
    if value.respond_to?(:each)
      value.each do |obj|
        file = File.join(dir, obj)
        errors.add("File not found: #{file}") unless File.exists?(file)
      end
    else
      errors.add("#{name} is not enumerable")
    end
  end
end