puppetlabs_spec_helper recommends rspec-mocks instead of mocha[1] and
it uses rspec-mocks by default instead of mocha since v 5.0.0[2]
This is the prep work to adapt to that migration.
[1] https://github.com/puppetlabs/puppetlabs_spec_helper/#mock_with
[2] 493f0cbc1c
Closes-Bug: #2004135
Change-Id: I273711da547446f2c37be84656d0e3be2a3f9ec7
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			877 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			877 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
require 'spec_helper'
 | 
						|
 | 
						|
describe 'os_workers_heat_engine' do
 | 
						|
 | 
						|
  before { Facter.clear }
 | 
						|
 | 
						|
  context 'with processorcount=1' do
 | 
						|
    before do
 | 
						|
      allow(Facter.fact(:processors)).to receive(:value).and_return({'count' => 1})
 | 
						|
    end
 | 
						|
 | 
						|
    it 'returns a minimum of 2' do
 | 
						|
      expect(Facter.fact(:os_workers_heat_engine).value).to eq(4)
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
  context 'with processorcount=8' do
 | 
						|
    before do
 | 
						|
      allow(Facter.fact(:processors)).to receive(:value).and_return({'count' => 8})
 | 
						|
    end
 | 
						|
 | 
						|
    it 'returns processorcount/2' do
 | 
						|
      expect(Facter.fact(:os_workers_heat_engine).value).to eq(4)
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
  context 'with processorcount=64' do
 | 
						|
    before do
 | 
						|
      allow(Facter.fact(:processors)).to receive(:value).and_return({'count' => 64})
 | 
						|
    end
 | 
						|
 | 
						|
    it 'returns a maximum of 24' do
 | 
						|
      expect(Facter.fact(:os_workers_heat_engine).value).to eq(24)
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |