Module: RSpec::Puppet::ManifestMatchers

Extended by:
Matchers::DSL
Included in:
ClassExampleGroup, DefineExampleGroup, FunctionExampleGroup, HostExampleGroup
Defined in:
lib/rspec-puppet/matchers/unique_values.rb,
lib/rspec-puppet/matchers/create_generic.rb,
lib/rspec-puppet/matchers/dynamic_matchers.rb,
lib/rspec-puppet/matchers/parameter_matcher.rb,
lib/rspec-puppet/matchers/include_class.rb,
lib/rspec-puppet/matchers/count_generic.rb,
lib/rspec-puppet/matchers/compile.rb

Defined Under Namespace

Classes: Compile, CountGeneric, CreateGeneric, ParameterMatcher

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rspec-puppet/matchers/dynamic_matchers.rb', line 5

def method_missing(method, *args, &block)
  if /^(create|contain)_/.match?(method.to_s)
    return RSpec::Puppet::ManifestMatchers::CreateGeneric.new(method, *args,
                                                              &block)
  end
  if /^have_.+_count$/.match?(method.to_s)
    return RSpec::Puppet::ManifestMatchers::CountGeneric.new(nil, args[0],
                                                             method)
  end
  return RSpec::Puppet::ManifestMatchers::Compile.new if method == :compile

  super
end

Instance Method Details

#have_class_count(count) ⇒ Object



81
82
83
# File 'lib/rspec-puppet/matchers/count_generic.rb', line 81

def have_class_count(count)
  RSpec::Puppet::ManifestMatchers::CountGeneric.new('class', count)
end

#have_resource_count(count) ⇒ Object



85
86
87
# File 'lib/rspec-puppet/matchers/count_generic.rb', line 85

def have_resource_count(count)
  RSpec::Puppet::ManifestMatchers::CountGeneric.new('resource', count)
end