Module: Beaker::DSL::Helpers::TestHelpers

Included in:
Beaker::DSL::Helpers
Defined in:
lib/beaker/dsl/helpers/test_helpers.rb

Overview

Methods that help you query the state of your tests, these methods do not require puppet to be installed to execute correctly

Instance Method Summary collapse

Instance Method Details

#current_step_nameString

Gets the currently executing test's currently executing step name. This is set using the Structure#step method.


32
33
34
# File 'lib/beaker/dsl/helpers/test_helpers.rb', line 32

def current_step_name()
  [:step] && [:step][:name] ? [:step][:name] : nil
end

#current_test_filenameString

Gets the currently executing test's filename, which is set from the @path variable passed into the TestCase#initialize method, not including the '.rb' extension

Examples:

if the path variable was man/plan/canal.rb, then the filename would be:

canal

24
25
26
# File 'lib/beaker/dsl/helpers/test_helpers.rb', line 24

def current_test_filename()
  [:case] && [:case][:file_name] ? [:case][:file_name] : nil
end

#current_test_nameString

Gets the currently executing test's name, which is set in a test using the Structure#test_name method.


12
13
14
# File 'lib/beaker/dsl/helpers/test_helpers.rb', line 12

def current_test_name()
  [:case] && [:case][:name] ? [:case][:name] : nil
end

#set_current_step_name(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets the currently executing step's name.


64
65
66
67
# File 'lib/beaker/dsl/helpers/test_helpers.rb', line 64

def set_current_step_name(name)
  [:step] ||= {}
  [:step][:name] = name
end

#set_current_test_filename(filename) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets the currently executing test's filename.


53
54
55
56
# File 'lib/beaker/dsl/helpers/test_helpers.rb', line 53

def set_current_test_filename(filename)
  [:case] ||= {}
  [:case][:file_name] = filename
end

#set_current_test_name(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets the currently executing test's name.


42
43
44
45
# File 'lib/beaker/dsl/helpers/test_helpers.rb', line 42

def set_current_test_name(name)
  [:case] ||= {}
  [:case][:name] = name
end