Class: RSpec::Puppet::EventListener

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

Class Method Summary collapse

Class Method Details

.example_failed(example) ⇒ Object



27
28
29
# File 'lib/rspec-puppet/monkey_patches.rb', line 27

def self.example_failed(example)
  @rspec_puppet_example = false
end

.example_passed(example) ⇒ Object



19
20
21
# File 'lib/rspec-puppet/monkey_patches.rb', line 19

def self.example_passed(example)
  @rspec_puppet_example = false
end

.example_pending(example) ⇒ Object



23
24
25
# File 'lib/rspec-puppet/monkey_patches.rb', line 23

def self.example_pending(example)
  @rspec_puppet_example = false
end

.example_started(example) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rspec-puppet/monkey_patches.rb', line 11

def self.example_started(example)
  if rspec3?
    @rspec_puppet_example = example.example.example_group.ancestors.include?(RSpec::Puppet::Support)
  else
    @rspec_puppet_example = example.example_group.ancestors.include?(RSpec::Puppet::Support)
  end
end

.rspec3?Boolean

Returns:



35
36
37
38
39
40
41
# File 'lib/rspec-puppet/monkey_patches.rb', line 35

def self.rspec3?
  if @rspec3.nil?
    @rspec3 = defined?(RSpec::Core::Notifications)
  end

  @rspec3
end

.rspec_puppet_example?Boolean

Returns:



31
32
33
# File 'lib/rspec-puppet/monkey_patches.rb', line 31

def self.rspec_puppet_example?
  @rspec_puppet_example || false
end