diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-30 12:13:51 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-30 12:13:51 +0000 |
commit | 7faafa5ab5ac3a1f242af789874e011f3253866f (patch) | |
tree | 4fb1bdecea302385945eca42c6cab94146d941af /features | |
parent | 03538558d9de40beeaf5758fe2a0c6febfef6c96 (diff) | |
parent | 9aedf9c42c4eb2328d3ad9da671d9e05f4543326 (diff) | |
download | gitlab-ce-7faafa5ab5ac3a1f242af789874e011f3253866f.tar.gz |
Merge branch 'rs-spinach-reporter' into 'master'
Monkey patch the Spinach StdoutReporter to show scenario locations
See merge request !10321
Diffstat (limited to 'features')
-rw-r--r-- | features/support/env.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/features/support/env.rb b/features/support/env.rb index f394c30d52f..26cdd9d746d 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -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) |