<commit_before>require 'spec_helper'

testcases = {
  'user1' => {
    params: { },
    expect: { home: '/home/user1', sh: false }
  },
  'user2' => {
    params: { set_sh: true },
    expect: { home: '/home/user2', sh: true }
  },
  'root' => {
    params: { },
    expect: { home: '/root', sh: false }
  },
}

describe 'ohmyzsh::install' do
  testcases.each do |user, values|
    context "testing #{user}" do
      let(:title) { user }
      let(:params) { values[:params] }
      it do
        should contain_exec("ohmyzsh::git clone #{user}")
          .with_creates("#{values[:expect][:home]}/.oh-my-zsh")
          .with_command("git clone https://github.com/robbyrussell/oh-my-zsh.git #{values[:expect][:home]}/.oh-my-zsh")
          .with_user(user)
      end
      it do
        should contain_exec("ohmyzsh::cp .zshrc #{user}")
          .with_creates("#{values[:expect][:home]}/.zshrc")
          .with_command("cp #{values[:expect][:home]}/.oh-my-zsh/templates/zshrc.zsh-template #{values[:expect][:home]}/.zshrc")
          .with_user(user)
      end
      if values[:expect][:sh]
        it do
          should contain_user("ohmyzsh::user #{user}")
            .with_name(user)
            .with_shell("/usr/bin/zsh")
        end
      end
    end
  end #testcases.each
end #describe<commit_msg>updated tests for pull request #1<commit_after>require 'spec_helper'

testcases = {
  'user1' => {
    params: { },
    expect: { home: '/home/user1', sh: false }
  },
  'user2' => {
    params: { set_sh: true },
    expect: { home: '/home/user2', sh: true }
  },
  'root' => {
    params: { },
    expect: { home: '/root', sh: false }
  },
}

describe 'ohmyzsh::install' do
  testcases.each do |user, values|
    context "testing #{user}" do
      let(:title) { user }
      let(:params) { values[:params] }
      it do
        should contain_exec("ohmyzsh::git clone #{user}")
          .with_creates("#{values[:expect][:home]}/.oh-my-zsh")
          .with_command("git clone https://github.com/robbyrussell/oh-my-zsh.git #{values[:expect][:home]}/.oh-my-zsh || rmdir ${home}/.oh-my-zsh && exit 1")
          .with_user(user)
      end
      it do
        should contain_exec("ohmyzsh::cp .zshrc #{user}")
          .with_creates("#{values[:expect][:home]}/.zshrc")
          .with_command("cp #{values[:expect][:home]}/.oh-my-zsh/templates/zshrc.zsh-template #{values[:expect][:home]}/.zshrc")
          .with_user(user)
      end
      if values[:expect][:sh]
        it do
          should contain_user("ohmyzsh::user #{user}")
            .with_name(user)
            .with_shell("/usr/bin/zsh")
        end
      end
    end
  end #testcases.each
end #describe
{'fraction_non_alphanumeric': 0.187593423019432, 'fraction_numerical': 0.0037369207772795215, 'mean_word_length': 2.4497422680412373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '3600134', 'n_tokens_mistral': 957, 'n_tokens_neox': 957, 'n_words': 172}