Skip to content

Commit

Permalink
Prefer string interpolation to string concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Feb 4, 2023
1 parent 4011404 commit a7b740e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/twitter/streaming/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def close
def request(method, uri, params)
before_request.call
headers = Twitter::Headers.new(self, method, uri, params).request_headers
request = HTTP::Request.new(verb: method, uri: uri + '?' + to_url_params(params), headers: headers, proxy: proxy)
request = HTTP::Request.new(verb: method, uri: "#{uri}?#{to_url_params(params)}", headers: headers, proxy: proxy)
response = Streaming::Response.new do |data|
if item = Streaming::MessageParser.parse(data) # rubocop:disable Lint/AssignmentInCondition
yield(item)
Expand Down
2 changes: 1 addition & 1 deletion spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def fixture_path
end

def fixture(file)
File.new(fixture_path + '/' + file)
File.new("#{fixture_path}/#{file}")
end

def capture_warning
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/headers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Twitter::Headers do
before do
@client = Twitter::REST::Client.new(consumer_key: 'CK', consumer_secret: 'CS', access_token: 'AT', access_token_secret: 'AS')
@headers = Twitter::Headers.new(@client, :get, Twitter::REST::Request::BASE_URL + '/path')
@headers = Twitter::Headers.new(@client, :get, "#{Twitter::REST::Request::BASE_URL}/path")
end

describe '#oauth_auth_header' do
Expand Down Expand Up @@ -40,7 +40,7 @@
describe '#bearer_auth_header' do
it 'creates the correct auth headers with supplied bearer token' do
client = Twitter::REST::Client.new(bearer_token: 'BT')
headers = Twitter::Headers.new(client, :get, Twitter::REST::Request::BASE_URL + '/path')
headers = Twitter::Headers.new(client, :get, "#{Twitter::REST::Request::BASE_URL}/path")
authorization = headers.send(:bearer_auth_header)
expect(authorization).to eq('Bearer BT')
end
Expand Down

0 comments on commit a7b740e

Please sign in to comment.