rspec-github 2.0.0.rc.1 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b5657c8bfed1cd2a4d022c48ab829cf4c2f283dbf450d347380c2c187e17f2
4
- data.tar.gz: 07a78f3aca65611c525349e501dcda46cc87c2947192fef8773331c2a040b2d9
3
+ metadata.gz: 485c8f607c6cd3ed202fa9d3bfa57748690d6d5d4c873a279bb5cb2721b877f3
4
+ data.tar.gz: c585043532f30a1a7c566ae34c415a8e2e082a8a8086f49085bef924336605fc
5
5
  SHA512:
6
- metadata.gz: 228aaa29974a2dc3be7f2d8f3545a84070f2db531c4aacfc89d724c5a2f06afe23f390c8d92672731743606b0f7cf2425a3a6542792840f89c83b79ccd867e8a
7
- data.tar.gz: 0a39b2ac417b839f9f368ac44aa038e524a55e82afc0d882a0a7374161d2298ee8ccbf4db927e51dd6aec7c5e4cab5fd26dd8d7877f3450a31f4fa208815bd7c
6
+ metadata.gz: ab02dcc31838a67b5498c129c6439e45e0c46c50f6ecd8d95490787072e42d5115141dac23b134074faec441e084d8dd4cc786b3a4d507dc765b637330e75846
7
+ data.tar.gz: 8fdaeebc694a6560a3d3d69f6bc873a0b273030ba9765482f1a974b9239e176be443db0efb22a448a624135d2913d66a3f9a3cd7b0e8b49c0882cadad76047fd
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rspec/core'
4
4
  require 'rspec/core/formatters/base_formatter'
5
+ require 'rspec/github/notification_decorator'
5
6
 
6
7
  module RSpec
7
8
  module Github
@@ -9,13 +10,15 @@ module RSpec
9
10
  RSpec::Core::Formatters.register self, :example_failed, :example_pending
10
11
 
11
12
  def example_failed(failure)
12
- file, line = failure.example.location.split(':')
13
- output.puts "::error file=#{file},line=#{line}::#{failure.message_lines.join('%0A')}"
13
+ notification = NotificationDecorator.new(failure)
14
+
15
+ output.puts "\n::error file=#{notification.path},line=#{notification.line}::#{notification.annotation}"
14
16
  end
15
17
 
16
18
  def example_pending(pending)
17
- file, line = pending.example.location.split(':')
18
- output.puts "::warning file=#{file},line=#{line}::#{pending.example.full_description}"
19
+ notification = NotificationDecorator.new(pending)
20
+
21
+ output.puts "\n::warning file=#{notification.path},line=#{notification.line}::#{notification.annotation}"
19
22
  end
20
23
  end
21
24
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpec
4
+ module Github
5
+ class NotificationDecorator
6
+ # See https://github.community/t/set-output-truncates-multiline-strings/16852/3.
7
+ ESCAPE_MAP = {
8
+ '%' => '%25',
9
+ "\n" => '%0A',
10
+ "\r" => '%0D'
11
+ }.freeze
12
+
13
+ def initialize(notification)
14
+ @notification = notification
15
+ end
16
+
17
+ def line
18
+ example.location.split(':')[1]
19
+ end
20
+
21
+ def annotation
22
+ "#{example.full_description}\n\n#{message}"
23
+ .gsub(Regexp.union(ESCAPE_MAP.keys), ESCAPE_MAP)
24
+ end
25
+
26
+ def path
27
+ # TODO: use `delete_prefix` when dropping ruby 2.4 support
28
+ File.realpath(raw_path).sub(/\A#{workspace}#{File::SEPARATOR}/, '')
29
+ end
30
+
31
+ private
32
+
33
+ def example
34
+ @notification.example
35
+ end
36
+
37
+ def message
38
+ if @notification.respond_to?(:message_lines)
39
+ @notification.message_lines.join("\n")
40
+ else
41
+ "#{example.skip ? 'Skipped' : 'Pending'}: #{example.execution_result.pending_message}"
42
+ end
43
+ end
44
+
45
+ def raw_path
46
+ example.location.split(':')[0]
47
+ end
48
+
49
+ def workspace
50
+ File.realpath(ENV.fetch('GITHUB_WORKSPACE', '.'))
51
+ end
52
+ end
53
+ end
54
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Github
5
- VERSION = '2.0.0.rc.1'
5
+ VERSION = '2.3.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc.1
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stef Schenkelaars
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -24,20 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rubocop
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 0.81.0
47
+ version: '1.0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 0.81.0
54
+ version: '1.0'
41
55
  description: Formatter for RSpec to show errors in GitHub action annotations
42
56
  email:
43
57
  - stef.schenkelaars@gmail.com
@@ -47,6 +61,7 @@ extra_rdoc_files: []
47
61
  files:
48
62
  - lib/rspec/github.rb
49
63
  - lib/rspec/github/formatter.rb
64
+ - lib/rspec/github/notification_decorator.rb
50
65
  - lib/rspec/github/version.rb
51
66
  homepage: https://drieam.github.io/rspec-github
52
67
  licenses:
@@ -63,12 +78,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
78
  requirements:
64
79
  - - ">="
65
80
  - !ruby/object:Gem::Version
66
- version: 2.3.0
81
+ version: 2.4.0
67
82
  required_rubygems_version: !ruby/object:Gem::Requirement
68
83
  requirements:
69
- - - ">"
84
+ - - ">="
70
85
  - !ruby/object:Gem::Version
71
- version: 1.3.1
86
+ version: '0'
72
87
  requirements: []
73
88
  rubygems_version: 3.1.2
74
89
  signing_key: