<commit_before>require 'spec_helper'

module ChefSpec
  describe ChefRunner do
    describe "#initialize" do
      it "should create a node for use within the examples" do
        runner = ChefSpec::ChefRunner.new
        expect(runner.node).not_to be_nil
      end
      it "should set the chef cookbook path to a default if not provided" do
        Chef::Config[:cookbook_path] = nil
        ChefSpec::ChefRunner.new
        expect(Chef::Config[:cookbook_path]).not_to be_nil
      end
      it "should set the chef cookbook path to any provided value" do
        ChefSpec::ChefRunner.new(:cookbook_path => '/tmp/foo')
        expect(Chef::Config[:cookbook_path]).to eql '/tmp/foo'
      end
      it "should support the chef cookbook path being passed as a string for backwards compatibility" do
        Chef::Config[:cookbook_path] = nil
        ChefSpec::ChefRunner.new('/tmp/bar')
        expect(Chef::Config[:cookbook_path]).to eql '/tmp/bar'
      end
      it "should default the log_level to warn" do
        expect(Chef::Log.level).to eql :warn
      end
      it "should set the log_level to any provided value" do
        Chef::Log.stub(:info)
        ChefSpec::ChefRunner.new(:log_level => :info)
        expect(Chef::Log.level).to eql :info
      end
      it "should alias the real resource actions" do<commit_msg>Fix specs<commit_after>require 'spec_helper'

module ChefSpec
  describe ChefRunner do
    describe "#initialize" do
      before do
        File.stub(:exists?).and_return(false)
      end
      it "should create a node for use within the examples" do
        runner = ChefSpec::ChefRunner.new
        expect(runner.node).not_to be_nil
      end
      it "should set the chef cookbook path to a default if not provided" do
        Chef::Config[:cookbook_path] = nil
        ChefSpec::ChefRunner.new
        expect(Chef::Config[:cookbook_path]).not_to be_nil
      end
      it "should set the chef cookbook path to any provided value" do
        File.stub(:exists?).with('/tmp/foo').and_return(true)
        ChefSpec::ChefRunner.new(:cookbook_path => '/tmp/foo')
        expect(Chef::Config[:cookbook_path]).to eql ['/tmp/foo']
      end
      it "should support the chef cookbook path being passed as a string for backwards compatibility" do
        Chef::Config[:cookbook_path] = nil
        File.stub(:exists?).with('/tmp/bar').and_return(true)
        ChefSpec::ChefRunner.new('/tmp/bar')
        expect(Chef::Config[:cookbook_path]).to eql ['/tmp/bar']
      end
      it "should default the log_level to warn" do
        expect(Chef::Log.level).to eql :warn
      end
      it "should set the log_level to any provided value" do
        Chef::Log.stub(:info)
        ChefSpec::ChefRunner.new(:log_level => :info)
        expect(Chef::Log.level).to eql :info
      end
      it "should alias the real resource actions" do
{'fraction_non_alphanumeric': 0.10364145658263306, 'fraction_numerical': 0.0, 'mean_word_length': 2.7992021276595747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4605706', 'n_tokens_mistral': 861, 'n_tokens_neox': 855, 'n_words': 254}