rspec-sonarqube-formatter 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rspec_sonarqube_formatter.rb +14 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18abf270b6d19003f2e9930ebc83037e1f071b7ec451ab3fb41956ed83e3b8ea
|
4
|
+
data.tar.gz: 93979f9fc568b961dbaa8e1b5a96108e39db5a00f773091f9a3ccc8905268b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06dde19cae5242ebf42bae5fc25373e30c68cc807b33cd2baf4fc58466ca0332209ca8890d0699417dbd9d2dc4c1cc93504d0f6451935c21623984cfb9d9ad2d
|
7
|
+
data.tar.gz: 76fb13fd00d7ab2f4b8fbaae33021b9bb1af930dceb868c4a7ffde2d30c85f61221b346cb5b88b7aecfbce43d083f8bcc177793b130ff63a97d649eb4e87c1c6
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class RspecSonarqubeFormatter
|
4
|
-
::RSpec::Core::Formatters.register self,
|
5
|
-
:
|
4
|
+
::RSpec::Core::Formatters.register self,
|
5
|
+
:start, :stop, :example_group_started, :example_started, :example_passed, :example_failed, :example_pending
|
6
6
|
|
7
7
|
def initialize(output)
|
8
8
|
@output = output
|
@@ -29,20 +29,22 @@ class RspecSonarqubeFormatter
|
|
29
29
|
@current_file = notification.group.metadata[:file_path]
|
30
30
|
end
|
31
31
|
|
32
|
-
def example_started(
|
33
|
-
@output.puts
|
32
|
+
def example_started(_notification)
|
33
|
+
@output.puts ''
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
@output.puts "
|
38
|
-
@output.puts ' </testCase>'
|
36
|
+
def example_passed(notification)
|
37
|
+
@output.puts " <testCase name=\"#{clean_string(notification.example.description)}\" duration=\"#{duration(notification.example)}\" />"
|
39
38
|
end
|
40
39
|
|
41
|
-
def
|
40
|
+
def example_failed(notification)
|
41
|
+
@output.puts " <testCase name=\"#{clean_string(notification.example.description)}\" duration=\"#{duration(notification.example)}\">"
|
42
|
+
@output.puts " <failure message=\"#{notification.exception}\" stacktrace=\"#{notification.example.location}\" />"
|
42
43
|
@output.puts ' </testCase>'
|
43
44
|
end
|
44
45
|
|
45
46
|
def example_pending(notification)
|
47
|
+
@output.puts " <testCase name=\"#{clean_string(notification.example.description)}\" duration=\"#{duration(notification.example)}\">"
|
46
48
|
@output.puts " <skipped message=\"#{clean_string(notification.example.execution_result.pending_message)}\" />"
|
47
49
|
@output.puts ' </testCase>'
|
48
50
|
end
|
@@ -50,4 +52,8 @@ class RspecSonarqubeFormatter
|
|
50
52
|
def clean_string(input)
|
51
53
|
input.to_s.gsub(/\e\[\d;*\d*m/, '').tr('"', "'")
|
52
54
|
end
|
55
|
+
|
56
|
+
def duration(example)
|
57
|
+
(example.execution_result.run_time.to_f * 1000).round
|
58
|
+
end
|
53
59
|
end
|