Class: RSpec::Puppet::EventListener

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

Class Method Summary collapse

Class Method Details

.current_exampleObject



48
49
50
# File 'lib/rspec-puppet/monkey_patches.rb', line 48

def self.current_example
  @current_example
end

.example_failed(example) ⇒ Object



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

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

.example_passed(example) ⇒ Object



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

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

.example_pending(example) ⇒ Object



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

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

.example_started(example) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# 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)
    @current_example = example.example
    if !@current_example.respond_to?(:environment) && @current_example.respond_to?(:example_group_instance)
      @current_example = @current_example.example_group_instance
    end
  else
    @rspec_puppet_example = example.example_group.ancestors.include?(RSpec::Puppet::Support)
    @current_example = example
  end
end

.rspec3?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
# File 'lib/rspec-puppet/monkey_patches.rb', line 40

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

  @rspec3
end

.rspec_puppet_example?Boolean

Returns:

  • (Boolean)


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

def self.rspec_puppet_example?
  @rspec_puppet_example || false
end