diff --git a/.github/workflows/octokit.yml b/.github/workflows/octokit.yml index d0c3e2a11..efc32edbe 100644 --- a/.github/workflows/octokit.yml +++ b/.github/workflows/octokit.yml @@ -37,12 +37,17 @@ jobs: ruby-version: ${{ matrix.ruby }} - name: Setup .netrc run: chmod 600 spec/fixtures/.netrc + - name: Ruby 2.5 needs a newer RubyGems to support frozen-string-literal + if: ${{ matrix.ruby == '2.5' }} + run: gem update --system 2.7.11 - name: Install dependencies run: | bundle config set path .bundle/gems bundle config set without development bundle install --jobs 4 --retry 3 + gem env version - name: Test with RSpec env: GITHUB_CI: 1 + RUBYOPT: --enable-frozen-string-literal run: bundle exec rspec -w diff --git a/lib/octokit/error.rb b/lib/octokit/error.rb index 5ceb50a54..6206a66ae 100644 --- a/lib/octokit/error.rb +++ b/lib/octokit/error.rb @@ -180,7 +180,7 @@ def response_error def response_error_summary return nil unless data.is_a?(Hash) && !Array(data[:errors]).empty? - summary = "\nError summary:\n" + summary = +"\nError summary:\n" summary << data[:errors].map do |error| if error.is_a? Hash error.map { |k,v| " #{k}: #{v}" } @@ -195,8 +195,8 @@ def response_error_summary def build_error_message return nil if @response.nil? - message = "#{@response[:method].to_s.upcase} " - message << redact_url(@response[:url].to_s) + ": " + message = +"#{@response[:method].to_s.upcase} " + message << redact_url(@response[:url].to_s.dup) + ": " message << "#{@response[:status]} - " message << "#{response_message}" unless response_message.nil? message << "#{response_error}" unless response_error.nil?