From b49ec66715200affd0ee402eac3c7b15b1d321d8 Mon Sep 17 00:00:00 2001 From: Lucas Caton Date: Tue, 8 Nov 2022 20:12:10 +1000 Subject: [PATCH] Fix Rubocop offences --- lib/octokit/connection.rb | 4 ++-- spec/octokit/client/contents_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/octokit/connection.rb b/lib/octokit/connection.rb index b66be00ee..b18998ae8 100644 --- a/lib/octokit/connection.rb +++ b/lib/octokit/connection.rb @@ -209,8 +209,8 @@ def parse_query_and_convenience_headers(options) def response_data_correctly_encoded(response) # TODO: I'm guessing base64 content responses are still broken, but this fixes the bug we're running into - content_type= response.headers.fetch("content-type", "") - return response.data unless content_type.include?("charset") && response.data.is_a?(String) + content_type = response.headers.fetch('content-type', '') + return response.data unless content_type.include?('charset') && response.data.is_a?(String) reported_encoding = content_type.match(/charset=([^ ]+)/)[1] response.data.force_encoding(reported_encoding) diff --git a/spec/octokit/client/contents_spec.rb b/spec/octokit/client/contents_spec.rb index 337046b9b..0328e75ae 100644 --- a/spec/octokit/client/contents_spec.rb +++ b/spec/octokit/client/contents_spec.rb @@ -26,11 +26,11 @@ assert_requested :get, github_url('/repos/octokit/octokit.rb/contents/lib/octokit.rb') end - it "returns the contents of a file properly encoded as specified by the response headers" do - contents = @client.contents("octokit/octokit.rb", :path => "spec/fixtures/utf8.en.js", accept: "application/vnd.github.V3.raw") - expect(contents).to eq(File.read("spec/fixtures/utf8.en.js")) + it 'returns the contents of a file properly encoded as specified by the response headers' do + contents = @client.contents('octokit/octokit.rb', path: 'spec/fixtures/utf8.en.js', accept: 'application/vnd.github.V3.raw') + expect(contents).to eq(File.read('spec/fixtures/utf8.en.js')) expect(contents.encoding).to eq(Encoding::UTF_8) - assert_requested :get, github_url("/repos/octokit/octokit.rb/contents/spec/fixtures/utf8.en.js") + assert_requested :get, github_url('/repos/octokit/octokit.rb/contents/spec/fixtures/utf8.en.js') end end # .contents