class LookOut::RSpec::LookOutFormatter
Public Instance Methods
close(_notification)
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 8 def close(_notification) output_hash[:examples].each do |example| %i(full_description pending_message).each do |key| example.delete(key) end end hydra = Typhoeus::Hydra.hydra first_mate_request = Typhoeus::Request.new( "#{first_mate_host}/casts", method: :post, headers: { 'Content-Type' => 'application/json' }, body: { api_key: LookOut.config.api_key, data: output_hash, cast: { user: user, sha: sha, env: env, integrated: integrated } }.to_json ) hydra.queue(first_mate_request) if defined?(SimpleCov) SimpleCov.result.format! data = { 'coverage' => SimpleCov.result.to_hash['RSpec']['coverage']. transform_keys { |key| key.sub(/^#{SimpleCov.root}/, '') } } red_request = Typhoeus::Request.new( "#{red_cove_host}/sails", method: :post, body: { api_key: LookOut.config.api_key, data: data, sail: { uid: uid, user: user, sha: sha, env: env, integrated: integrated } } ) hydra.queue(red_request) end hydra.run if ENV['LOOK_OUT_VERBOSE'] pp first_mate_request pp first_mate_request&.response pp red_request pp red_request&.response end end
Private Instance Methods
env()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 104 def env if ENV['JENKINS'] || ENV['CI'] :integration else :development end end
first_mate_host()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 84 def first_mate_host ENV['FIRST_MATE_HOST'] || 'https://sea-aye.com/api/first-mate' end
integrated()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 88 def integrated if ENV['LOOK_OUT_INTEGRATED'] true else false end end
red_cove_host()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 80 def red_cove_host ENV['RED_COVE_HOST'] || 'https://sea-aye.com/api/red-cove' end
sha()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 75 def sha ENV['GIT_COMMIT_SHA'] || ENV['HEROKU_TEST_RUN_COMMIT_VERSION'] || ENV['CIRCLE_SHA1'] || `git log -1 --format=%H`.chomp end
uid()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 71 def uid ENV['TRAVIS_BUILD_ID'] || ENV['HEROKU_TEST_RUN_ID'] || ENV['CIRCLE_WORKFLOW_ID'] || SecureRandom.hex end
user()
click to toggle source
# File lib/look_out/rspec/look_out_formatter.rb, line 96 def user if LookOut.config.user && !LookOut.config.user.empty? LookOut.config.user else ENV['LOOK_OUT_USER'] || `git config user.name`.chomp end end