<commit_before>require 'spec_helper'

describe 'collectd::plugin::zfs_arc', type: :class do
  let :facts do
    {
      collectd_version: '4.8.0',
      operatingsystemmajrelease: '7',
      python_dir: '/usr/local/lib/python2.7/dist-packages'
    }
  end

  context ':ensure => present' do
    let :facts do
      {
        osfamily: 'FreeBSD',
        collectd_version: '4.8.0',
        operatingsystemmajrelease: '7',
        python_dir: '/usr/local/lib/python2.7/dist-packages'
      }
    end

    it 'Will create 10-zfs_arc.conf' do
      is_expected.to contain_file('zfs_arc.load').with(ensure: 'present',
                                                       path: '/usr/local/etc/collectd/10-zfs_arc.conf',
                                                       content: %r{\#\ Generated by Puppet\nLoadPlugin zfs_arc\n})
    end
  end

  context ':ensure => absent' do
    let :facts do
      {
        osfamily: 'FreeBSD',
        collectd_version: '4.8.0',
        operatingsystemmajrelease: '7',
        python_dir: '/usr/local/lib/python2.7/dist-packages'
      }
    end
    let :params do
      { ensure: 'absent' }
    end

    it 'Will not create 10-zfs_arc.conf' do
      is_expected.to contain_file('zfs_arc.load').with(ensure: 'absent',
                                                       path: '/usr/local/etc/collectd/10-zfs_arc.conf')
    end
  end
end
<commit_msg>migrate collectd_plugin_zfs_arc tests to rspec-puppet-facts<commit_after>require 'spec_helper'

describe 'collectd::plugin::zfs_arc', type: :class do
  on_supported_os.each do |os, facts|
    context "on #{os} " do
      let :facts do
        facts.merge(collectd_version: '4.8')
      end

      options = os_specific_options(facts)
      context ':ensure => present' do

        it 'Will create 10-zfs_arc.conf' do
          is_expected.to contain_file('zfs_arc.load').with(
            ensure: 'present',
            path: "#{options[:plugin_conf_dir]}/10-zfs_arc.conf",
            content: %r{\#\ Generated by Puppet\nLoadPlugin zfs_arc\n}
          )
        end
      end

      context ':ensure => absent' do
        let :params do
          { ensure: 'absent' }
        end

        it 'Will not create 10-zfs_arc.conf' do
          is_expected.to contain_file('zfs_arc.load').with(
            ensure: 'absent',
            path: "#{options[:plugin_conf_dir]}/10-zfs_arc.conf"
          )
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.1196546052631579, 'fraction_numerical': 0.014802631578947368, 'mean_word_length': 1.8895486935866983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7239667', 'n_tokens_mistral': 824, 'n_tokens_neox': 788, 'n_words': 164}