 b5bd19a630
			
		
	
	b5bd19a630
	
	
	
		
			
			Facter.clear clears all cached values and removes all facts from memory where Facter.flush just clears the cached values. This should reduce the time it takes to actually run the unit tests as it all the other facts we're touching won't be removed from memory. Also we only need to do it before the tests, not before and after. Change-Id: I9a24dc9f74cb3b59508b12e63a078068c26c1442
		
			
				
	
	
		
			27 lines
		
	
	
		
			547 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			547 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require 'spec_helper'
 | |
| 
 | |
| describe 'os_workers_large' do
 | |
| 
 | |
|   before { Facter.flush }
 | |
| 
 | |
|   context 'with processorcount=1' do
 | |
|     before do
 | |
|       Facter.fact(:processorcount).stubs(:value).returns(1)
 | |
|     end
 | |
| 
 | |
|     it 'returns a minimum of 1' do
 | |
|       expect(Facter.fact(:os_workers_large).value).to eq(1)
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   context 'with processorcount=8' do
 | |
|     before do
 | |
|       Facter.fact(:processorcount).stubs(:value).returns(8)
 | |
|     end
 | |
| 
 | |
|     it 'returns processorcount/2' do
 | |
|       expect(Facter.fact(:os_workers_large).value).to eq(4)
 | |
|     end
 | |
|   end
 | |
| end
 |