Sha256: aa8d870603c54c18e3541d3cae0c89113ec2b215f8a82544f9350777dcb5bcdf

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe HeadChef::Diff do
  describe 'ClassMethods' do
    let(:berksfile) { double('Berkshelf::Berksfile') }
    let(:chef_environment) { double('Hashie::Mash') }
    let(:environment) { 'test_env' }

    describe '::diff' do
      before(:each) do
        HeadChef.stub_chain(:chef_server, :environment, :find).
          with(environment).
          and_return(chef_environment)

        allow(chef_environment).to receive(:cookbook_versions).and_return({})

        allow(HeadChef).to receive(:berksfile).and_return(berksfile)
        allow(berksfile).to receive(:install).and_return([])
      end

      after(:each) do
        described_class.diff(environment)
      end

      it 'loads chef environment' do
        expect(chef_environment).to receive(:cookbook_versions)
      end

      it 'calls Berksfile#install to load berkshelf cookbooks into cache' do
        expect(berksfile).to receive(:install)
      end

      it 'returns CookbookDiff' do
        expect(described_class.diff(environment)).to be_an_instance_of(HeadChef::CookbookDiff)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
head_chef-0.1.1 spec/diff_spec.rb
head_chef-0.1.0 spec/diff_spec.rb