lib/gurke/reporter.rb in gurke-3.0.0 vs lib/gurke/reporter.rb in gurke-3.1.0
- old
+ new
@@ -5,12 +5,10 @@
# A {Reporter} provides callbacks that will be executed whenever
# a specific execution step starts or ends.
#
# @api public
#
- # rubocop:disable MissingCopEnableDirective
- # rubocop:disable UnusedMethodArgument
#
class Reporter
# List of all callback methods as symbols.
#
CALLBACKS = %i[
@@ -40,11 +38,11 @@
# @param features [Array<Feature>] List of all features that
# are going to be executed.
#
# @api public
#
- def before_features(features)
+ def before_features(_features)
raise NotImplementedError.new \
"#{self.class.name}#before_features must be implemented in subclass."
end
# Called before the execute of any feature, but after all
@@ -53,11 +51,11 @@
# @param features [Array<Feature>] List of all features that
# are going to be executed.
#
# @api public
#
- def start_features(features)
+ def start_features(_features)
raise NotImplementedError.new \
"#{self.class.name}#before_features must be implemented in subclass."
end
# Called for each feature before it starts, but before any
@@ -66,11 +64,11 @@
# @param feature [Feature] The feature that is going to
# be executed now.
#
# @api public
#
- def before_feature(feature)
+ def before_feature(_feature)
raise NotImplementedError.new \
"#{self.class.name}#start_feature must be implemented in subclass."
end
# Called for each feature before it starts, but after
@@ -79,11 +77,11 @@
# @param feature [Feature] The feature that is going to
# be executed now.
#
# @api public
#
- def start_feature(feature)
+ def start_feature(_feature)
raise NotImplementedError.new \
"#{self.class.name}#start_feature must be implemented in subclass."
end
# Called for each each scenario before it starts. Will be
@@ -91,11 +89,11 @@
#
# @param scenario [Scenario] Current scenario.
#
# @api public
#
- def before_scenario(scenario)
+ def before_scenario(_scenario)
raise NotImplementedError.new \
"#{self.class.name}#before_scenario must be implemented in subclass."
end
# Called for each each scenario before it starts, but after
@@ -103,11 +101,11 @@
#
# @param scenario [Scenario] Current scenario.
#
# @api public
#
- def start_scenario(scenario)
+ def start_scenario(_scenario)
raise NotImplementedError.new \
"#{self.class.name}#start_scenario must be implemented in subclass."
end
# Called before each background.
@@ -115,11 +113,11 @@
# @param background [Background] Current background.
# @param scenario [Scenario] Current scenario.
#
# @api public
#
- def start_background(background, scenario)
+ def start_background(_background, _scenario)
raise NotImplementedError.new \
"#{self.class.name}#start_background must be implemented in subclass."
end
# Called after each background.
@@ -127,11 +125,11 @@
# @param background [Background] Current background.
# @param scenario [Scenario] Current scenario.
#
# @api public
#
- def end_background(background, scenario)
+ def end_background(_background, _scenario)
raise NotImplementedError.new \
"#{self.class.name}#end_background must be implemented in subclass."
end
# Called before each step and before any before-step hook.
@@ -139,11 +137,11 @@
# @param step [Step] Current Step.
# @param scenario [Scenario] Current scenario.
#
# @api public
#
- def before_step(step, scenario)
+ def before_step(_step, _scenario)
raise NotImplementedError.new \
"#{self.class.name}#before_step must be implemented in subclass."
end
# Called before each step and after all before-step hooks.
@@ -151,11 +149,11 @@
# @param step [Step] Current Step.
# @param scenario [Scenario] Current scenario.
#
# @api public
#
- def start_step(step, scenario)
+ def start_step(_step, _scenario)
raise NotImplementedError.new \
"#{self.class.name}#start_step must be implemented in subclass."
end
# Called after each step but before any after-step hook.
@@ -164,11 +162,11 @@
# @param scenario [Scenario] Current scenario.
# @param feature [Feature] Current feature.
#
# @api public
#
- def end_step(step_result, scenario)
+ def end_step(_step_result, _scenario)
raise NotImplementedError.new \
"#{self.class.name}#end_step must be implemented in subclass."
end
# Called after each step, after all step hook.
@@ -177,11 +175,11 @@
# @param scenario [Scenario] Current scenario.
# @param feature [Feature] Current feature.
#
# @api public
#
- def after_step(step_result, scenario)
+ def after_step(_step_result, _scenario)
raise NotImplementedError.new \
"#{self.class.name}#after_step must be implemented in subclass."
end
# Called after each scenario but before any after hook.
@@ -189,11 +187,11 @@
# @param scenario [Scenario] Current scenario.
# @param feature [Feature] Current feature.
#
# @api public
#
- def end_scenario(scenario)
+ def end_scenario(_scenario)
raise NotImplementedError.new \
"#{self.class.name}#end_scenario must be implemented in subclass."
end
# Called after each scenario and after all hooks.
@@ -201,55 +199,55 @@
# @param scenario [Scenario] Current scenario.
# @param feature [Feature] Current feature.
#
# @api public
#
- def after_scenario(scenario)
+ def after_scenario(_scenario)
raise NotImplementedError.new \
"#{self.class.name}#after_scenario must be implemented in subclass."
end
# Called after each feature but before any after hook.
#
# @param feature [Feature] Current feature.
#
# @api public
#
- def end_feature(feature)
+ def end_feature(_feature)
raise NotImplementedError.new \
"#{self.class.name}#end_feature must be implemented in subclass."
end
# Called after each feature and after all hooks.
#
# @param feature [Feature] Current feature.
#
# @api public
#
- def after_feature(feature)
+ def after_feature(_feature)
raise NotImplementedError.new \
"#{self.class.name}#after_feature must be implemented in subclass."
end
# Called after all features but before any after-features hook.
#
# @param features [Array<Feature>] List of all features.
#
# @api public
#
- def end_features(features)
+ def end_features(_features)
raise NotImplementedError.new \
"#{self.class.name}#end_features must be implemented in subclass."
end
# Called after all features and after all hooks.
#
# @param features [Array<Feature>] List of all features.
#
# @api public
#
- def after_features(features)
+ def after_features(_features)
raise NotImplementedError.new \
"#{self.class.name}#after_features must be implemented in subclass."
end
# @visibility private
@@ -263,29 +261,27 @@
#
protected
def format_exception(ex, backtrace: true)
- s = [ex.class.to_s + ': ' + ex.message.strip]
+ s = ex.class.to_s << ': ' << ex.message.strip << "\n"
if backtrace
if ex.backtrace.nil?
s << ' <no backtrace available>'
elsif ex.backtrace.empty?
s << ' <backtrace empty>'
else
ex.backtrace.each do |bt|
- s << ' ' + bt.strip
+ s << ' ' << bt.strip << "\n"
end
end
end
if ex.respond_to?(:cause) && ex.cause &&
ex.cause.respond_to?(:message) && ex.cause.respond_to?(:backtrace)
- cause = format_exception(ex.cause, backtrace: backtrace)
- s << 'caused by: ' + cause.shift
- s += cause
+ s << 'caused by: ' << format_exception(ex.cause, backtrace: backtrace)
end
s
end
end