<commit_before>require 'spec_helper'

describe 'ufw::allow', :type => :define do
  let(:title) { 'foo' }
  context 'basic operation' do
    it { should contain_exec('ufw-allow-tcp-from-any-to-any-port-all').
      with_command("ufw allow proto tcp from any to any").
      with_unless('ufw status | grep -E " +ALLOW +Anywhere"')
    }
  end

  context 'specifying from address' do
    let(:params) { {:from => '192.0.2.42'} }
    it { should contain_exec('ufw-allow-tcp-from-192.0.2.42-to-any-port-all').
      with_command("ufw allow proto tcp from 192.0.2.42 to any").
      with_unless('ufw status | grep -E " +ALLOW +192.0.2.42/tcp"')
    }
  end

  describe 'specifying to address' do
    context 'from ipaddress_eth0 fact' do
      let(:facts) { {:ipaddress_eth0 => '192.0.2.67'} }
      it { should contain_exec('ufw-allow-tcp-from-any-to-192.0.2.67-port-all').
        with_command("ufw allow proto tcp from any to 192.0.2.67").
        with_unless('ufw status | grep -E "192.0.2.67/tcp +ALLOW +Anywhere"')
      }
    end

    context 'from $ip parameter' do
      let(:params) { {:ip => '192.0.2.68'} }
      it { should contain_exec('ufw-allow-tcp-from-any-to-192.0.2.68-port-all').
        with_command("ufw allow proto tcp from any to 192.0.2.68").
        with_unless('ufw status | grep -E "192.0.2.68/tcp +ALLOW +Anywhere"')
      }
    end

    context 'when both $ip and ipaddress_eth0 are specified' do
      let(:facts) { {:ipaddress_eth0 => '192.0.2.67'} }
      let(:params) { {:ip => '192.0.2.68'} }
      it { should contain_exec('ufw-allow-tcp-from-any-to-192.0.2.68-port-all').
        with_command("ufw allow proto tcp from any to 192.0.2.68").
        with_unless('ufw status | grep -E "192.0.2.68/tcp +ALLOW +Anywhere"')
      }
    end
  end
<commit_msg>fix test to match module<commit_after>require 'spec_helper'

describe 'ufw::allow', :type => :define do
  let(:title) { 'foo' }
  context 'basic operation' do
    it { should contain_exec('ufw-allow-tcp-from-any-to-any-port-all').
      with_command("ufw allow proto tcp from any to any").
      with_unless('ufw status | grep -E " +ALLOW +Anywhere"')
    }
  end

  context 'specifying from address' do
    let(:params) { {:from => '192.0.2.42'} }
    it { should contain_exec('ufw-allow-tcp-from-192.0.2.42-to-any-port-all').
      with_command("ufw allow proto tcp from 192.0.2.42 to any").
      with_unless('ufw status | grep -E " +ALLOW +192.0.2.42"')
    }
  end

  describe 'specifying to address' do
    context 'from ipaddress_eth0 fact' do
      let(:facts) { {:ipaddress_eth0 => '192.0.2.67'} }
      it { should contain_exec('ufw-allow-tcp-from-any-to-192.0.2.67-port-all').
        with_command("ufw allow proto tcp from any to 192.0.2.67").
        with_unless('ufw status | grep -E "192.0.2.67/tcp +ALLOW +Anywhere"')
      }
    end

    context 'from $ip parameter' do
      let(:params) { {:ip => '192.0.2.68'} }
      it { should contain_exec('ufw-allow-tcp-from-any-to-192.0.2.68-port-all').
        with_command("ufw allow proto tcp from any to 192.0.2.68").
        with_unless('ufw status | grep -E "192.0.2.68/tcp +ALLOW +Anywhere"')
      }
    end

    context 'when both $ip and ipaddress_eth0 are specified' do
      let(:facts) { {:ipaddress_eth0 => '192.0.2.67'} }
      let(:params) { {:ip => '192.0.2.68'} }
      it { should contain_exec('ufw-allow-tcp-from-any-to-192.0.2.68-port-all').
        with_command("ufw allow proto tcp from any to 192.0.2.68").
        with_unless('ufw status | grep -E "192.0.2.68/tcp +ALLOW +Anywhere"')
      }
    end
  end

{'fraction_non_alphanumeric': 0.16764623565631123, 'fraction_numerical': 0.0688497061293031, 'mean_word_length': 2.6247464503042597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 34, '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': '498497', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1328, 'n_words': 306}