<commit_before>require 'spec_helper_acceptance'

case fact('osfamily')
  when 'AIX'
    username = 'root'
    groupname = 'system'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
  when 'Darwin'
    username = 'root'
    groupname = 'wheel'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
  when 'windows'
    username = 'Administrator'
    groupname = 'Administrators'
    scriptname = 'concatfragments.rb'
    result = on default, "echo #{default['puppetvardir']}"
    vardir = result.raw_output.chomp
  when 'Solaris'
    username = 'root'
    groupname = 'root'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
  else
    username = 'root'
    groupname = 'root'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
end

describe 'basic concat test' do
  basedir = default.tmpdir('concat')
  safe_basedir = basedir.gsub(/[\/:]/, '_')

  shared_examples 'successfully_applied' do |pp|
    it 'applies the manifest twice with no stderr' do
      apply_manifest(pp, :catch_failures => true)<commit_msg>check for nil<commit_after>require 'spec_helper_acceptance'

case fact('osfamily')
  when 'AIX'
    username = 'root'
    groupname = 'system'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir.nil? or vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
  when 'Darwin'
    username = 'root'
    groupname = 'wheel'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir.nil? or vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
  when 'windows'
    username = 'Administrator'
    groupname = 'Administrators'
    scriptname = 'concatfragments.rb'
    result = on default, "echo #{default['puppetvardir']}"
    vardir = result.raw_output.chomp
  when 'Solaris'
    username = 'root'
    groupname = 'root'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir.nil? or vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
  else
    username = 'root'
    groupname = 'root'
    scriptname = 'concatfragments.rb'
    vardir = default['puppetvardir']
    if vardir.nil? or vardir == ''
      vardir = '/opt/puppetlabs/puppet/cache'
    end
end

describe 'basic concat test' do
  basedir = default.tmpdir('concat')
  safe_basedir = basedir.gsub(/[\/:]/, '_')

  shared_examples 'successfully_applied' do |pp|
    it 'applies the manifest twice with no stderr' do
      apply_manifest(pp, :catch_failures => true)
{'fraction_non_alphanumeric': 0.1278825995807128, 'fraction_numerical': 0.0, 'mean_word_length': 3.143270622286541, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1759433', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1011, 'n_words': 217}