lib/onceover/testconfig.rb in onceover-3.20.0 vs lib/onceover/testconfig.rb in onceover-3.21.0
- old
+ new
@@ -25,16 +25,17 @@
attr_accessor :mock_functions
attr_accessor :before_conditions
attr_accessor :after_conditions
attr_accessor :skip_r10k
attr_accessor :force
+ attr_accessor :fail_fast
attr_accessor :strict_variables
attr_accessor :formatters
def initialize(file, opts = {})
begin
- config = YAML.safe_load(File.read(file), [Symbol])
+ config = YAML.safe_load(File.read(file), permitted_classes: [Symbol])
rescue Errno::ENOENT
raise "Could not find #{file}"
rescue Psych::SyntaxError
raise "Could not parse #{file}, check that it is valid YAML and that the encoding is correct"
end
@@ -77,10 +78,11 @@
@filter_tags = opts[:tags] ? [opts[:tags].split(',')].flatten : nil
@filter_classes = opts[:classes] ? [opts[:classes].split(',')].flatten.map {|x| Onceover::Class.find(x)} : nil
@filter_nodes = opts[:nodes] ? [opts[:nodes].split(',')].flatten.map {|x| Onceover::Node.find(x)} : nil
@skip_r10k = opts[:skip_r10k] ? true : false
@force = opts[:force] || false
+ @fail_fast = opts[:fail_fast] || false
# Validate the mock_functions
if @mock_functions && @mock_functions.any? { |name, details| details.has_key? 'type' }
logger.warn "The 'type' key for mocked functions is deprecated and will be ignored, please remove it."
end
@@ -240,10 +242,10 @@
def copy_spec_files(repo)
source_files = @included_specs.map { |glob| Dir.glob "#{repo.spec_dir}/#{glob}" }.flatten.uniq
source_files.each do |source_file|
target_file = File.join(repo.tempdir, 'spec', source_file.sub(/^#{repo.spec_dir}/, ''))
if File.directory?(source_file)
- FileUtils.cp_r source_file, target_file unless File.exists? target_file
+ FileUtils.cp_r source_file, target_file unless File.exist? target_file
else
FileUtils.mkdir_p File.dirname target_file
FileUtils.cp source_file, target_file
end
end