<commit_before>require 'spec_helper'

# Facts mocked up for unit testing
FACTS = {
  :osfamily => 'Debian',
  :operatingsystem => 'Ubuntu',
  :operatingsystemrelease => '12',
  :lsbdistid => 'Ubuntu',
  :lsbdistcodename => 'precise',
  :lsbdistrelease => '12.04',
  :lsbmajdistrelease => '12',
  :kernel => 'linux',
}

describe 'opsmatic::puppet_reporter', :type => 'class' do

  context 'default params' do
    let(:facts) { FACTS }
    it do
      expect {
        should compile.with_all_deps
      }.to raise_error(/Opsmatic install token/)
    end
  end

  context 'token => <PASSWORD>' do
    let(:facts) { FACTS }
    let(:params) {{ :token => '<PASSWORD>' }}
    it do
      should compile.with_all_deps
      should contain_class('opsmatic::debian')
      should contain_package('opsmatic-puppet-reporter').with(
        'ensure' => '0.1.125')
      should contain_service('opsmatic-puppet-reporter')
    end
  end

  context 'ensure => absent' do
    let(:facts) { FACTS }
    let(:params) {{ :ensure => 'absent' }}
    it do
      should compile.with_all_deps
      should contain_package('opsmatic-puppet-reporter').with(
        'ensure' => '0.1.125')

      should_not contain_service('opsmatic-puppet-reporter')

      should contain_exec('kill-opsmatic-puppet-reporter').with(
        'command' => 'killall -9 opsmatic-puppet-reporter')
    end
  end

end<commit_msg>fix the one spec test failure that makes sense (was a bad test)<commit_after>require 'spec_helper'

# Facts mocked up for unit testing
FACTS = {
  :osfamily => 'Debian',
  :operatingsystem => 'Ubuntu',
  :operatingsystemrelease => '12',
  :lsbdistid => 'Ubuntu',
  :lsbdistcodename => 'precise',
  :lsbdistrelease => '12.04',
  :lsbmajdistrelease => '12',
  :kernel => 'linux',
}

describe 'opsmatic::puppet_reporter', :type => 'class' do

  context 'default params' do
    let(:facts) { FACTS }
    it do
      expect {
        should compile.with_all_deps
      }.to raise_error(/Opsmatic install token/)
    end
  end

  context 'token => 1234' do
    let(:facts) { FACTS }
    let(:params) {{ :token => '1234' }}
    it do
      should compile.with_all_deps
      should contain_class('opsmatic::debian')
      should contain_package('opsmatic-puppet-reporter').with(
        'ensure' => 'latest')
      should contain_service('opsmatic-puppet-reporter')
    end
  end

  context 'ensure => absent' do
    let(:facts) { FACTS }
    let(:params) {{ :ensure => 'absent' }}
    it do
      should compile.with_all_deps
      should contain_package('opsmatic-puppet-reporter').with(
        'ensure' => 'absent')

      should_not contain_service('opsmatic-puppet-reporter')

      should contain_exec('kill-opsmatic-puppet-reporter').with(
        'command' => 'killall -9 opsmatic-puppet-reporter')
    end
  end

end
{'fraction_non_alphanumeric': 0.14204139900071378, 'fraction_numerical': 0.01284796573875803, 'mean_word_length': 3.2150375939849622, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '5308053', 'n_tokens_mistral': 1006, 'n_tokens_neox': 940, 'n_words': 207}