<commit_before>require 'spec_helper'

describe HeadChef do
  let(:berksfile) { Berkshelf::Berksfile }
  let(:branch) { 'curr_branch' }
  let(:repo) { double('Grit::Repo') }

  before(:each) do
    allow(Grit::Repo).to receive(:new).with('.').and_return(repo)

    stub_const("HeadChef::BERKSFILE_COOKBOOK_DIR", '.head_chef')
  end

  describe 'ClassMethods' do
    describe '::ui' do
      it 'returns Thor shell' do
        expect(subject.ui).to be_an_instance_of(Thor::Base.shell)
      end
    end

    describe '::chef_server' do
      it 'creates Ridley::Client' do
        expect(Ridley).to receive(:from_chef_config).with(no_args)
        subject.chef_server
      end
    end

    describe '::master_cookbook' do
      it 'returns Grit repo' do
        expect(subject.master_cookbook).to eq(repo)
      end
    end

    describe '::current_branch' do
      before do
        allow(subject).to receive(:master_cookbook).and_return(repo)
        repo.stub_chain(:head, :name).and_return(branch)
      end

      it 'returns current branch' do
        expect(subject.current_branch).to eq(branch)
      end
    end

    describe '::berksfile' do
      before(:each) do
        allow(berksfile).to receive(:from_file).with(anything()).
          and_return(Berkshelf::Berksfile.new(''))<commit_msg>Fixes HeadChef::berskfile test<commit_after>require 'spec_helper'

describe HeadChef do
  let(:berksfile) { Berkshelf::Berksfile }
  let(:branch) { 'curr_branch' }
  let(:repo) { double('Grit::Repo') }

  before(:each) do
    allow(Grit::Repo).to receive(:new).with('.').and_return(repo)

    stub_const("HeadChef::BERKSFILE_LOCATION", './Berksfile')
    stub_const("HeadChef::BERKSFILE_COOKBOOK_DIR", '.head_chef')
  end

  describe 'ClassMethods' do
    describe '::ui' do
      it 'returns Thor shell' do
        expect(subject.ui).to be_an_instance_of(Thor::Base.shell)
      end
    end

    describe '::chef_server' do
      it 'creates Ridley::Client' do
        expect(Ridley).to receive(:from_chef_config).with(no_args)
        subject.chef_server
      end
    end

    describe '::master_cookbook' do
      it 'returns Grit repo' do
        expect(subject.master_cookbook).to eq(repo)
      end
    end

    describe '::current_branch' do
      before do
        allow(subject).to receive(:master_cookbook).and_return(repo)
        repo.stub_chain(:head, :name).and_return(branch)
      end

      it 'returns current branch' do
        expect(subject.current_branch).to eq(branch)
      end
    end

    describe '::berksfile' do
      before(:each) do
        allow(berksfile).to receive(:from_file).
          with(HeadChef::BERKSFILE_LOCATION).
          and_return(Berkshelf::Berksfile.new(''))
{'fraction_non_alphanumeric': 0.1264749262536873, 'fraction_numerical': 0.0, 'mean_word_length': 3.135670731707317, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1422596', 'n_tokens_mistral': 918, 'n_tokens_neox': 901, 'n_words': 172}