Class: Omnitest::Command::Show

Inherits:
Base
  • Object
show all
Includes:
Omnitest::Core::FileSystem, Omnitest::Core::Util::String, Reporters
Defined in:
lib/omnitest/command/show.rb

Overview

rubocop:disable Metrics/ClassLength

Constant Summary

Constants included from Reporters

Reporters::ASSETS_DIR, Reporters::GENERATORS_DIR, Reporters::RESOURCES_DIR

Instance Method Summary collapse

Methods included from Reporters

reporter

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Omnitest::Command::Base

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/omnitest/command/show.rb', line 10

def call
  @indent_level = 0
  setup
  @reporter = Omnitest::Reporters.reporter(options[:format], shell)
  scenarios = parse_subcommand(args.shift, args.shift)

  scenarios.each do | scenario |
    status_color = scenario.status_color.to_sym
    status(scenario.slug, colorize(scenario.status_description, status_color), status_color)
    indent do
      status('Test suite', scenario.suite)
      status('Test scenario', scenario.name)
      status('Project', scenario.psychic.name)
      source_file = if scenario.code_sample
                      Core::FileSystem.relativize(scenario.absolute_source_file, Dir.pwd)
                    else
                      colorize('<No code sample>', :red)
                    end
      status('Source', source_file)
      display_source(scenario)
      display_execution_result(scenario)
      display_validations(scenario)
      display_spy_data(scenario)
    end
  end
end