<commit_before>require 'spec_helper'

describe 'hosts' do
  let(:hosts_file) { '/etc/hosts' }
  let(:fqdn_warning) { 'fqdn warning' }

  context 'file resource' do
    it { should contain_file(hosts_file).with(
      :ensure => 'present',
      :owner  => 'root',
      :group  => 'root',
      :mode   => '0644',
    )}
  end

  context 'self' do
    context 'domain and FQDN set correctly' do
      let(:facts) {{
        :hostname   => 'foo',
        :domainname => 'example.com',
        :fqdn       => 'foo.example.com',
      }}

      it { should contain_file(hosts_file).with_content(<commit_msg>Remove a trailing comma for 1.8.7 compat.<commit_after>require 'spec_helper'

describe 'hosts' do
  let(:hosts_file) { '/etc/hosts' }
  let(:fqdn_warning) { 'fqdn warning' }

  context 'file resource' do
    it { should contain_file(hosts_file).with(
      :ensure => 'present',
      :owner  => 'root',
      :group  => 'root',
      :mode   => '0644'
    )}
  end

  context 'self' do
    context 'domain and FQDN set correctly' do
      let(:facts) {{
        :hostname   => 'foo',
        :domainname => 'example.com',
        :fqdn       => 'foo.example.com',
      }}

      it { should contain_file(hosts_file).with_content(
{'fraction_non_alphanumeric': 0.1522267206477733, 'fraction_numerical': 0.008906882591093117, 'mean_word_length': 2.4915254237288136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '3920061', 'n_tokens_mistral': 441, 'n_tokens_neox': 413, 'n_words': 97}