8
9
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# 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.to_json,
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
|