Class: RSpec::Puppet::FacterTestImpl
- Inherits:
- 
      Object
      
        - Object
- RSpec::Puppet::FacterTestImpl
 
- Defined in:
- lib/rspec-puppet/facter_impl.rb
Overview
Implements a simple hash-based version of Facter to be used in module tests that use rspec-puppet.
Instance Method Summary collapse
- #add(name, options = {}, &block) ⇒ Object
- #clear ⇒ Object
- 
  
    
      #debugging(arg)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    noop methods. 
- 
  
    
      #initialize  ⇒ FacterTestImpl 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of FacterTestImpl. 
- #reset ⇒ Object
- #search(*paths) ⇒ Object
- #setup_logging ⇒ Object
- #to_hash ⇒ Object
- #value(fact_name) ⇒ Object
Constructor Details
#initialize ⇒ FacterTestImpl
Returns a new instance of FacterTestImpl.
| 6 7 8 | # File 'lib/rspec-puppet/facter_impl.rb', line 6 def initialize @facts = {} end | 
Instance Method Details
#add(name, options = {}, &block) ⇒ Object
| 22 23 24 25 | # File 'lib/rspec-puppet/facter_impl.rb', line 22 def add(name, = {}, &block) raise 'Facter.add expects a block' unless block_given? @facts[name.to_s] = instance_eval(&block) end | 
#clear ⇒ Object
| 14 15 16 | # File 'lib/rspec-puppet/facter_impl.rb', line 14 def clear @facts.clear end | 
#debugging(arg) ⇒ Object
noop methods
| 28 | # File 'lib/rspec-puppet/facter_impl.rb', line 28 def debugging(arg); end | 
#reset ⇒ Object
| 30 | # File 'lib/rspec-puppet/facter_impl.rb', line 30 def reset; end | 
#search(*paths) ⇒ Object
| 32 | # File 'lib/rspec-puppet/facter_impl.rb', line 32 def search(*paths); end | 
#setup_logging ⇒ Object
| 34 | # File 'lib/rspec-puppet/facter_impl.rb', line 34 def setup_logging; end | 
#to_hash ⇒ Object
| 18 19 20 | # File 'lib/rspec-puppet/facter_impl.rb', line 18 def to_hash @facts end | 
#value(fact_name) ⇒ Object
| 10 11 12 | # File 'lib/rspec-puppet/facter_impl.rb', line 10 def value(fact_name) @facts[fact_name.to_s] end |