Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frozen string literal #1033

Merged
merged 2 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/webmock.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'singleton'

require 'addressable/uri'
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/api.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
module API
extend self
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/assertion_failure.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class AssertionFailure
@error_class = RuntimeError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/callback_registry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class CallbackRegistry
@@callbacks = []
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/config.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class Config
include Singleton
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/cucumber.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'webmock'
require 'webmock/rspec/matchers'

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/deprecation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class Deprecation
class << self
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/errors.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

class NetConnectNotAllowedError < Exception
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/async_http_client_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'async'
require 'async/http'
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/curb_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'curb'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/em_http_request_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'em-http-request'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/excon_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'excon'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_lib_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class HttpLibAdapter
def self.adapter_for(lib)
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class HttpLibAdapterRegistry
include Singleton
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_rb/client.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module HTTP
class Client
alias_method :__perform__, :perform
Expand Down
4 changes: 3 additions & 1 deletion lib/webmock/http_lib_adapters/http_rb/request.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

module HTTP
class Request
def webmock_signature
request_body = if defined?(HTTP::Request::Body)
''.tap { |string| body.each { |part| string << part } }
String.new.tap { |string| body.each { |part| string << part } }
else
body
end
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_rb/response.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module HTTP
class Response
def to_webmock
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_rb/streamer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module HTTP
class Response
class Streamer
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_rb/webmock.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module HTTP
class WebMockPerform
def initialize(request, options, &perform)
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/http_rb_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require "http"
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/httpclient_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'httpclient'
require 'jsonclient' # defined in 'httpclient' gem as well
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/manticore_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'manticore'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/net_http.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'net/http'
require 'net/https'
require 'stringio'
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/net_http_response.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This code is entierly copied from VCR (http://github.com/myronmarston/vcr) by courtesy of Myron Marston

# A Net::HTTP response that has already been read raises an IOError when #read_body
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/patron_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'patron'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'typhoeus'
rescue LoadError
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/matchers/any_arg_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
module Matchers
# this is a based on RSpec::Mocks::ArgumentMatchers::AnyArgMatcher
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/matchers/hash_argument_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
module Matchers
# Base class for Hash matchers
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/matchers/hash_excluding_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
module Matchers
# this is a based on RSpec::Mocks::ArgumentMatchers::HashExcludingMatcher
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/matchers/hash_including_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
module Matchers
# this is a based on RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/minitest.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'minitest/test'
test_class = Minitest::Test
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/rack_response.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class RackResponse < Response
def initialize(app)
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_body_diff.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "hashdiff"
require "json"

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_execution_verifier.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class RequestExecutionVerifier

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_pattern.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

module RSpecMatcherDetector
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_registry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

class RequestRegistry
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_signature.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

class RequestSignature
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_signature_snippet.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "pp"

module WebMock
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/request_stub.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class RequestStub

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/response.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "pathname"

module WebMock
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/responses_sequence.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

class ResponsesSequence
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/rspec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'webmock'

# RSpec 1.x and 2.x compatibility
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/rspec/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'webmock'
require 'webmock/rspec/matchers/request_pattern_matcher'
require 'webmock/rspec/matchers/webmock_matcher'
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/rspec/matchers/request_pattern_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class RequestPatternMatcher

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/rspec/matchers/webmock_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class WebMockMatcher

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/stub_registry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

class StubRegistry
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/stub_request_snippet.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class StubRequestSnippet
def initialize(request_stub)
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/test_unit.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'test/unit'
require 'webmock'

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/hash_counter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'thread'

module WebMock
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/hash_keys_stringifier.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
module Util
class HashKeysStringifier
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/hash_validator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
class HashValidator
def initialize(hash)
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/headers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'base64'

module WebMock
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/json.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This is a copy of https://github.com/jnunemaker/crack/blob/master/lib/crack/json.rb
# with date parsing removed
# Copyright (c) 2004-2008 David Heinemeier Hansson
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/query_mapper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock::Util
class QueryMapper
class << self
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/uri.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

module Util
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/values_stringifier.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class WebMock::Util::ValuesStringifier
def self.stringify_values(value)
case value
Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/util/version_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This code was created based on https://github.com/myronmarston/vcr/blob/master/lib/vcr/util/version_checker.rb
# Thanks to @myronmarston

Expand Down
2 changes: 2 additions & 0 deletions lib/webmock/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock
VERSION = '3.18.1' unless defined?(::WebMock::VERSION)
end
2 changes: 2 additions & 0 deletions lib/webmock/webmock.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module WebMock

def self.included(clazz)
Expand Down