Class: Dri::Commands::Fetch::Testcases
- Inherits:
-
Dri::Command
- Object
- Dri::Command
- Dri::Commands::Fetch::Testcases
- Defined in:
- lib/dri/commands/fetch/testcases.rb
Instance Method Summary collapse
-
#execute(_input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(options) ⇒ Testcases
constructor
A new instance of Testcases.
Methods inherited from Dri::Command
#add_color, #api_client, #bold, #command, #cursor, #editor, #pastel, #prompt, #spinner, #verify_config_exists
Methods included from Utils::Helpers
Constructor Details
#initialize(options) ⇒ Testcases
Returns a new instance of Testcases.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dri/commands/fetch/testcases.rb', line 9 def initialize() @options = @available_pipelines = %w[ main canary master production staging-canary staging-ref staging ] end |
Instance Method Details
#execute(_input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Metrics/AbcSize
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/dri/commands/fetch/testcases.rb', line 22 def execute(_input: $stdin, output: $stdout) # rubocop:disable Metrics/AbcSize verify_config_exists if @options[:filter_pipelines] filtered_pipelines = prompt.multi_select("Select pipelines:", @available_pipelines) end logger.info "Fetching currently failing testcases..." title_label = add_color('Title:', :bright_yellow) url_label = add_color('URL:', :bright_yellow) divider = add_color('---', :cyan) spinner.start pipelines = @options[:filter_pipelines] ? filtered_pipelines : @available_pipelines logger.error "No pipelines selected to continue to fetch testcases." if pipelines.empty? pipelines.each do |pipeline| logger.info "Fetching failing testcases in #{pipeline}\n" response = api_client.fetch_failing_testcases(pipeline, state: 'opened') output.puts "♦♦♦♦♦ #{add_color(pipeline, :black, :on_white)}♦♦♦♦♦\n\n" response.each do |test_case| output.puts "#{title_label} #{test_case.title}\n#{url_label} #{test_case.web_url}" output.puts "#{divider}\n" end end spinner.stop end |