rspec-sonarqube-formatter 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d03dc70a76120bbde342dc6f56331c72ae5248387f708e38536f9004e001bce0
4
- data.tar.gz: 13d4cea8db2682c5bc4f5746d623d96e263ea1fb497be01f8cc74ecf5963d8f7
3
+ metadata.gz: 18abf270b6d19003f2e9930ebc83037e1f071b7ec451ab3fb41956ed83e3b8ea
4
+ data.tar.gz: 93979f9fc568b961dbaa8e1b5a96108e39db5a00f773091f9a3ccc8905268b7f
5
5
  SHA512:
6
- metadata.gz: ab2aca3efd4faf359b44f2cd72de0577aaf36e107e0225cb8b0ab1ad87b61a8662a2793d15abe5729a5e5166c62e6f6e98cd77e5da01cafe139e39422e2ff970
7
- data.tar.gz: 49264403b0ba4672af8e300745d16a62c57dc97304fd6f2483d481104394dde1ba7e39fe09276f44ad1cadb1123a1d73789584a0b4148b5ffaba8958e5ea12ac
6
+ metadata.gz: 06dde19cae5242ebf42bae5fc25373e30c68cc807b33cd2baf4fc58466ca0332209ca8890d0699417dbd9d2dc4c1cc93504d0f6451935c21623984cfb9d9ad2d
7
+ data.tar.gz: 76fb13fd00d7ab2f4b8fbaae33021b9bb1af930dceb868c4a7ffde2d30c85f61221b346cb5b88b7aecfbce43d083f8bcc177793b130ff63a97d649eb4e87c1c6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-sonarqube-formatter (1.0.0)
4
+ rspec-sonarqube-formatter (1.0.1)
5
5
  rspec (~> 3.0)
6
6
 
7
7
  GEM
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RspecSonarqubeFormatter
4
- ::RSpec::Core::Formatters.register self, :example_group_started, :example_started, :example_passed,
5
- :example_pending, :example_failed, :start, :stop, :exam
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(notification)
33
- @output.puts " <testCase name=\"#{clean_string(notification.example.description)}\" duration=\"#{(notification.example.execution_result.run_time.to_f * 1000).round}\">"
32
+ def example_started(_notification)
33
+ @output.puts ''
34
34
  end
35
35
 
36
- def example_failed(notification)
37
- @output.puts " <failure message=\"#{notification.exception}\" stacktrace=\"#{notification.example.location}\" />"
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 example_passed(_notification)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-sonarqube-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Graf