Commit 7faafa5a authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-spinach-reporter' into 'master'

Monkey patch the Spinach StdoutReporter to show scenario locations

See merge request !10321
parents 03538558 9aedf9c4
......@@ -33,3 +33,19 @@ Spinach.hooks.before_run do
include FactoryGirl::Syntax::Methods
end
module StdoutReporterWithScenarioLocation
# Override the standard reporter to show filename and line number next to each
# scenario for easy, focused re-runs
def before_scenario_run(scenario, step_definitions = nil)
@max_step_name_length = scenario.steps.map(&:name).map(&:length).max if scenario.steps.any?
name = scenario.name
# This number has no significance, it's just to line things up
max_length = @max_step_name_length + 19
out.puts "\n #{'Scenario:'.green} #{name.light_green.ljust(max_length)}" \
" # #{scenario.feature.filename}:#{scenario.line}"
end
end
Spinach::Reporter::Stdout.prepend(StdoutReporterWithScenarioLocation)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment