
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
829 B
Ruby
37 lines
829 B
Ruby
require 'spec_helper'
|
|
|
|
describe 'os_workers' 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).value).to eq(2)
|
|
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).value).to eq(4)
|
|
end
|
|
end
|
|
|
|
context 'with processorcount=32' do
|
|
before do
|
|
allow(Facter.fact(:processors)).to receive(:value).and_return({'count' => 32})
|
|
end
|
|
|
|
it 'returns a maximum of 12' do
|
|
expect(Facter.fact(:os_workers).value).to eq(12)
|
|
end
|
|
end
|
|
end
|