Module: RubyCI::DryrunRunnerPrepend

Defined in:
lib/ruby_ci/dryrun_runner_prepend.rb

Instance Method Summary collapse

Instance Method Details

#exit_code(examples_passed = false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ruby_ci/dryrun_runner_prepend.rb', line 12

def exit_code(examples_passed=false)
  run_time = Time.now - (@rspec_started_at || 1.seconds.ago)
  events = @world.non_example_failure ? [['RSPEC_DRYRUN', { failed_after: run_time, test_env_number: ENV["TEST_ENV_NUMBER"], data: 'error' }]] : [['RSPEC_DRYRUN', { succeed_after: run_time, test_env_number: ENV["TEST_ENV_NUMBER"] }]]
  STDOUT.puts events.inspect
  json_events = {
    build_id: RubyCI.configuration.orig_build_id,
    compressed_data: Base64.strict_encode64(Zlib::Deflate.deflate(JSON.fast_generate(events), 9)),
  }
  RubyCI.send_events(json_events)

  return @configuration.error_exit_code || @configuration.failure_exit_code if @world.non_example_failure
  return @configuration.failure_exit_code unless examples_passed

  0
end

#run(err, out) ⇒ Object



7
8
9
10
# File 'lib/ruby_ci/dryrun_runner_prepend.rb', line 7

def run(err, out)
  @rspec_started_at = Time.now
  super
end