rspec-github 1.0.0 → 2.3.0
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 +4 -4
- data/lib/rspec/github.rb +1 -1
- data/lib/rspec/github/formatter.rb +10 -8
- data/lib/rspec/github/notification_decorator.rb +53 -0
- data/lib/rspec/github/version.rb +2 -2
- metadata +17 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 809f1c358c9c727c2cb824a727cbf4d012238f30cb5d817274f5d05a719ec253
         | 
| 4 | 
            +
              data.tar.gz: 6b4771a4936c7cc0cffdd20b69399f75ca658fa7a5d097e8c9bcaafb15257473
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7cbdaf2dc830b47a275b30f037984212e2fdd791ca042c3d8886a74f69cf10c908fa4c078633261da96cf1c7df95333e4465aa93f9574a4c75066595855041ae
         | 
| 7 | 
            +
              data.tar.gz: edf61602b543774d83693a3438be2954d175a14a37e8c843af303f33a984ced3bc038dbf82194c7ef615d642f6c44a10756203237276be1162f7c9c77151379d
         | 
    
        data/lib/rspec/github.rb
    CHANGED
    
    
| @@ -1,22 +1,24 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require 'rspec/core | 
| 3 | 
            +
            require 'rspec/core'
         | 
| 4 | 
            +
            require 'rspec/core/formatters/base_formatter'
         | 
| 5 | 
            +
            require 'rspec/github/notification_decorator'
         | 
| 4 6 |  | 
| 5 7 | 
             
            module RSpec
         | 
| 6 8 | 
             
              module Github
         | 
| 7 | 
            -
                class Formatter < RSpec::Core::Formatters:: | 
| 9 | 
            +
                class Formatter < RSpec::Core::Formatters::BaseFormatter
         | 
| 8 10 | 
             
                  RSpec::Core::Formatters.register self, :example_failed, :example_pending
         | 
| 9 11 |  | 
| 10 12 | 
             
                  def example_failed(failure)
         | 
| 11 | 
            -
                     | 
| 12 | 
            -
             | 
| 13 | 
            -
                    output.puts "::error file=#{ | 
| 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 | 
            -
                     | 
| 18 | 
            -
             | 
| 19 | 
            -
                    output.puts "::warning file=#{ | 
| 19 | 
            +
                    notification = NotificationDecorator.new(pending)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    output.puts "\n::warning file=#{notification.path},line=#{notification.line}::#{notification.annotation}"
         | 
| 20 22 | 
             
                  end
         | 
| 21 23 | 
             
                end
         | 
| 22 24 | 
             
              end
         | 
| @@ -0,0 +1,53 @@ | |
| 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 | 
            +
                    File.realpath(raw_path).delete_prefix("#{workspace}#{File::SEPARATOR}")
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                  private
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  def example
         | 
| 33 | 
            +
                    @notification.example
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  def message
         | 
| 37 | 
            +
                    if @notification.respond_to?(:message_lines)
         | 
| 38 | 
            +
                      @notification.message_lines.join("\n")
         | 
| 39 | 
            +
                    else
         | 
| 40 | 
            +
                      "#{example.skip ? 'Skipped' : 'Pending'}: #{example.execution_result.pending_message}"
         | 
| 41 | 
            +
                    end
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  def raw_path
         | 
| 45 | 
            +
                    example.location.split(':')[0]
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  def workspace
         | 
| 49 | 
            +
                    File.realpath(ENV.fetch('GITHUB_WORKSPACE', '.'))
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
            end
         | 
    
        data/lib/rspec/github/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rspec-github
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 2.3.0
         | 
| 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- | 
| 11 | 
            +
            date: 2020-09-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: rspec-core
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '3.0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '3.0'
         | 
| 13 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 28 | 
             
              name: rspec
         | 
| 15 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -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:
         |