<commit_before>require 'spec_helper'

describe 'snapraid::default' do
  context 'On Ubuntu 14.04' do
    let(:chef_run) do
      runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node|
        node.set['snapraid']['content_files'] = ['/mnt/virtual']
        node.set['snapraid']['parity_disks'] = ['/mnt/virtual']
        node.set['snapraid']['data_disks'] = ['/mnt/virtual']
        node.set['snapraid']['block_size'] = '512'
      end

      runner.converge(described_recipe)
    end

    it 'installs snapraid' do
      expect(chef_run).to install_with_make_ark('snapraid')
    end

    it 'creates the correct configuration file' do
      expect(chef_run).to create_template('/etc/snapraid.conf')
      expect(chef_run).to render_file('/etc/snapraid.conf').with_content(%r{
        .*parity\s/mnt/virtual/snapraid.parity.*}x).with_content(%r{
        content\s/mnt/virtual/snapraid.content.*}x).with_content(%r{
        disk\sd1\s/mnt/virtual.*}x)
        .with_content(/
        block_size\s512.*/x)
    end
  end

  context 'On Windows 2012R2' do
    let(:chef_run) do
      runner = ChefSpec::SoloRunner.new(platform: 'windows',
                                        version: '2012r2',
                                        file_cache_path: 'C:\chef\cache') do |node|
        node.set['snapraid']['content_files'] = ['D:\\']
        node.set['snapraid']['parity_disks'] = ['D:\\']
        node.set['snapraid']['data_disks'] = ['D:\\']
        node.set['snapraid']['block_size'] = '512'
        node.set['snapraid']['install_directory'] = 'D:\SnapRaid'
        node.set['snapraid']['config_directory'] = 'D:\SnapRaid\Config'<commit_msg>trying to fix CI failures<commit_after>require 'spec_helper'

describe 'snapraid::default' do
  context 'On Ubuntu 14.04' do
    let(:chef_run) do
      runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node|
        node.set['snapraid']['content_files'] = ['/mnt/virtual']
        node.set['snapraid']['parity_disks'] = ['/mnt/virtual']
        node.set['snapraid']['data_disks'] = ['/mnt/virtual']
        node.set['snapraid']['block_size'] = '512'
      end

      runner.converge(described_recipe)
    end

    it 'installs snapraid' do
      expect(chef_run).to install_with_make_ark('snapraid')
    end

    it 'creates the correct configuration file' do
      expect(chef_run).to create_template('/etc/snapraid.conf')
      expect(chef_run).to render_file('/etc/snapraid.conf').with_content(%r{
        .*parity\s/mnt/virtual/snapraid.parity.*}x).with_content(%r{
        content\s/mnt/virtual/snapraid.content.*}x).with_content(%r{
        disk\sd1\s/mnt/virtual.*}x)
        .with_content(/
        block_size\s512.*/x)
    end
  end

  context 'On Windows 2012R2' do
    let(:chef_run) do
      runner = ChefSpec::SoloRunner.new(platform: 'windows',
                                        version: '2012R2',
                                        file_cache_path: 'C:\chef\cache') do |node|
        node.set['snapraid']['content_files'] = ['D:\\']
        node.set['snapraid']['parity_disks'] = ['D:\\']
        node.set['snapraid']['data_disks'] = ['D:\\']
        node.set['snapraid']['block_size'] = '512'
        node.set['snapraid']['install_directory'] = 'D:\SnapRaid'
        node.set['snapraid']['config_directory'] = 'D:\SnapRaid\Config'
{'fraction_non_alphanumeric': 0.17401668653158522, 'fraction_numerical': 0.0166865315852205, 'mean_word_length': 2.77615298087739, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7639073', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1113, 'n_words': 169}