module AllureStepAnnotation
Adds support for annotating methods as allure steps
Public Instance Methods
step(step_name = "")
click to toggle source
Mark method definition as allure step
@param [String] step_name @return [void]
# File lib/allure_ruby_commons/step_annotation.rb, line 10 def step(step_name = "") @allure_step = step_name end
Private Instance Methods
method_added(method_name)
click to toggle source
Calls superclass method
# File lib/allure_ruby_commons/step_annotation.rb, line 28 def method_added(method_name) return super unless @allure_step original_method = instance_method(method_name) step_name = @allure_step.empty? ? method_name.to_s : @allure_step @allure_step = nil define_method(method_name) do |*args, &block| Allure.run_step(step_name) { original_method.bind(self).call(*args, &block) } end end
singleton_method_added(method_name)
click to toggle source
Calls superclass method
# File lib/allure_ruby_commons/step_annotation.rb, line 16 def singleton_method_added(method_name) return super unless @allure_step original_method = singleton_method(method_name) step_name = @allure_step.empty? ? method_name.to_s : @allure_step @allure_step = nil define_singleton_method(method_name) do |*args, &block| Allure.run_step(step_name) { original_method.call(*args, &block) } end end