Module: RSpec::Puppet::ManifestMatchers

Extended by:
Matchers::DSL
Included in:
ApplicationExampleGroup, ClassExampleGroup, DefineExampleGroup, FunctionExampleGroup, HostExampleGroup
Defined in:
lib/rspec-puppet/matchers/parameter_matcher.rb,
lib/rspec-puppet/matchers/dynamic_matchers.rb,
lib/rspec-puppet/matchers/create_generic.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



3
4
5
6
7
8
# File 'lib/rspec-puppet/matchers/dynamic_matchers.rb', line 3

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

Instance Method Details

#have_class_count(count) ⇒ Object



79
80
81
# File 'lib/rspec-puppet/matchers/count_generic.rb', line 79

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

#have_resource_count(count) ⇒ Object



83
84
85
# File 'lib/rspec-puppet/matchers/count_generic.rb', line 83

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