Class: RSpec::Puppet::ManifestMatchers::Compile

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-puppet/matchers/compile.rb

Instance Method Summary collapse

Constructor Details

#initializeCompile

Returns a new instance of Compile.



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

def initialize
  @failed_resource = ""
  @check_deps = false
  @cycles = []
end

Instance Method Details

#descriptionObject



26
27
28
# File 'lib/rspec-puppet/matchers/compile.rb', line 26

def description
  "compile the catalogue without cycles"
end

#failure_message_for_shouldObject



30
31
32
33
34
35
36
# File 'lib/rspec-puppet/matchers/compile.rb', line 30

def failure_message_for_should
  unless @cycles.empty?
    "dependency cycles found: #{@cycles.join('; ')}"
  else
    "expected that the catalogue would include #{@failed_resource}"
  end
end

#failure_message_for_should_notObject



38
39
40
# File 'lib/rspec-puppet/matchers/compile.rb', line 38

def failure_message_for_should_not
  "expected that the catalogue would not compile but it does"
end

#matches?(catalogue) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
24
# File 'lib/rspec-puppet/matchers/compile.rb', line 15

def matches?(catalogue)
  @catalogue = catalogue
  if cycles_found?
    false
  elsif @check_deps == true && missing_dependencies?
    false
  else
    true
  end
end

#with_all_depsObject



10
11
12
13
# File 'lib/rspec-puppet/matchers/compile.rb', line 10

def with_all_deps
  @check_deps = true
  self
end