From 8a34b8db59d61a34b640807987b021d31c3ff68a Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Apr 2021 09:43:44 +0100 Subject: [PATCH] Moving over Excon adapter and tests from Faraday (#1) --- .github/workflows/ci.yml | 51 +++++++ .github/workflows/publish.yml | 29 ++++ .rubocop.yml | 58 ++++++++ .rubocop_todo.yml | 17 +++ README.md | 69 ++++++---- bin/console | 3 +- ...y_adapter.gemspec => faraday-excon.gemspec | 29 ++-- lib/faraday/adapter/excon.rb | 124 ++++++++++++++++++ lib/faraday/adapter/my_adapter.rb | 67 ---------- lib/faraday/excon.rb | 11 ++ lib/faraday/{my_adapter => excon}/version.rb | 4 +- lib/faraday/my_adapter.rb | 17 --- spec/faraday/adapter/excon_spec.rb | 49 +++++++ spec/faraday/adapter/my_adapter_spec.rb | 17 --- spec/faraday/excon_spec.rb | 7 + spec/faraday/my_adapter_spec.rb | 7 - spec/spec_helper.rb | 3 +- 17 files changed, 413 insertions(+), 149 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml rename faraday-my_adapter.gemspec => faraday-excon.gemspec (56%) create mode 100644 lib/faraday/adapter/excon.rb delete mode 100644 lib/faraday/adapter/my_adapter.rb create mode 100644 lib/faraday/excon.rb rename lib/faraday/{my_adapter => excon}/version.rb (57%) delete mode 100644 lib/faraday/my_adapter.rb create mode 100644 spec/faraday/adapter/excon_spec.rb delete mode 100644 spec/faraday/adapter/my_adapter_spec.rb create mode 100644 spec/faraday/excon_spec.rb delete mode 100644 spec/faraday/my_adapter_spec.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..53938f5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + pull_request: + push: + branches: [main, setup-ci] + schedule: + - cron: '0 8 * * 1' # At 8:00 on Monday + +env: + GIT_COMMIT_SHA: ${{ github.sha }} + GIT_BRANCH: ${{ github.ref }} + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - name: Set up Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + + - name: Rubocop + run: | + bin/setup + bin/ci-lint + + test: + needs: [lint] + runs-on: ubuntu-latest + strategy: + matrix: + ruby: ['2.5', '2.6', '2.7', '3.0'] + + steps: + - uses: actions/checkout@v1 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Build + run: | + bin/setup + + - name: Test + run: | + bin/ci-test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a932cec --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + build: + name: Publish to Rubygems + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: Set up Ruby 2.7 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.7.x + + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build faraday-excon.gemspec + gem push faraday-excon-*.gem + env: + GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }} diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..f300a1e --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,58 @@ +inherit_from: .rubocop_todo.yml + +require: + - rubocop-packaging + - rubocop-performance + +AllCops: + DisplayCopNames: true + DisplayStyleGuide: true + TargetRubyVersion: 2.4 + +Metrics/BlockLength: + Exclude: + - spec/**/*.rb + - examples/**/*.rb + +Layout/EmptyLinesAroundAttributeAccessor: # (0.83) + Enabled: true + +Layout/LineLength: + Exclude: + - spec/**/*.rb + - examples/**/*.rb + +Layout/SpaceAroundMethodCallOperator: + Enabled: true + +Lint/DeprecatedOpenSSLConstant: # (0.84) + Enabled: true + +Lint/RaiseException: + Enabled: true + +Lint/StructNewOverride: + Enabled: true + +Style/DoubleNegation: + Enabled: false + +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'examples/**/*' + +Style/ExponentialNotation: + Enabled: true +Style/HashEachMethods: + Enabled: true +Style/HashTransformKeys: + Enabled: true +Style/HashTransformValues: + Enabled: true +Style/IfUnlessModifier: + Enabled: false + +Style/SlicingWithRange: # (0.83) + Enabled: true + diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..572ee15 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,17 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2021-04-11 16:21:00 UTC using RuboCop version 0.91.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# Configuration parameters: IgnoredMethods. +Metrics/AbcSize: + Max: 32 + +# Offense count: 1 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods. +Metrics/MethodLength: + Max: 23 diff --git a/README.md b/README.md index 84eb6d2..4f6ab5c 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,59 @@ -# Faraday Adapter Template +# Faraday Excon adapter -This repo is a template for building [Faraday][faraday] adapters. +This gem is a [Faraday][faraday] adapter for the [Excon][excon] library. Faraday is an HTTP client library that provides a common interface over many adapters. -Every adapter is defined into it's own gem. Use this repository to create your own adapter gem. +Every adapter is defined into its own gem. This gem defines the adapter for Excon. -## Getting Started +## Installation -### Setting up and cloning the repo +Add this line to your application's Gemfile: -You can start using GitHub's [Use this template][use-template] button. -![Use this template](https://docs.github.com/assets/images/help/repository/use-this-template-button.png) +```ruby +gem 'faraday-excon' +``` -This will create a repository based off from this template. -After that is created, you can clone it locally to start working on it. +And then execute: -### Refactoring the template + $ bundle install -The next step is for you to find and replace all the "parametrised" names in this template and change them to make it unique. -First of all, you should decide on the name of your adapter. -The current convention (which is by no means mandatory) is to call adapter gems as `faraday-`. -Here are some examples: +Or install it yourself as: -* `HTTP`: [`faraday-http`][faraday-http] -* `Net::HTTP`: [`faraday-net_http`][faraday-net_http] + $ gem install faraday-excon -In this template repository, the placeholder for your chosen adapter name is `MyAdapter` (`my_adapter`). -So once you decide on the final name you want to use you should update all occurrences of `MyAdapter` and all files with `my_adapter` in their name with the new name you chose. +## Usage -### Main implementation +Configure your Faraday connection to use this adapter like this: -The bulk of the implementation is in the `Faraday::Adapter::MyAdapter` class. -We've added lots of comments in there to guide you through it, but if you have any doubt/question please don't hesitate to get in touch! +```ruby +connection = Faraday.new(url, conn_options) do |conn| + conn.adapter(:excon) +end +``` + +For more information on how to setup your Faraday connection and adapters usage, please refer to the [Faraday Website][faraday-website]. + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](rubygems). + +## Contributing + +Bug reports and pull requests are welcome on [GitHub][repo]. + +## License + +The gem is available as open source under the terms of the [license][license]. + +## Code of Conduct + +Everyone interacting in the Faraday Excon adapter project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct][code-of-conduct]. [faraday]: https://github.com/lostisland/faraday -[faraday-http]: https://github.com/lostisland/faraday-http -[faraday-net_http]: https://github.com/lostisland/faraday-net_http -[use-template]: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template +[faraday-website]: https://lostisland.github.io/faraday +[excon]: https://github.com/excon/excon +[rubygems]: https://rubygems.org +[repo]: https://github.com/lostisland/faraday-excon +[license]: https://github.com/lostisland/faraday-excon/blob/main/LICENSE.md +[code-of-conduct]: https://github.com/lostisland/faraday-excon/blob/main/CODE_OF_CONDUCT.md diff --git a/bin/console b/bin/console index d9d0639..b701bd1 100755 --- a/bin/console +++ b/bin/console @@ -2,7 +2,8 @@ # frozen_string_literal: true require 'bundler/setup' -require 'faraday-my_adapter' +require 'faraday' +require 'faraday/excon' # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/faraday-my_adapter.gemspec b/faraday-excon.gemspec similarity index 56% rename from faraday-my_adapter.gemspec rename to faraday-excon.gemspec index 79d7d77..2a56ac4 100644 --- a/faraday-my_adapter.gemspec +++ b/faraday-excon.gemspec @@ -1,34 +1,39 @@ # frozen_string_literal: true -require_relative 'lib/faraday/my_adapter/version' +require_relative 'lib/faraday/excon/version' Gem::Specification.new do |spec| - spec.name = 'faraday-my_adapter' - spec.version = Faraday::MyAdapter::VERSION - spec.authors = ['Your Name'] - spec.email = ['your_name@gmail.com'] - - spec.summary = 'Faraday adapter for MyAdapter' - spec.description = 'Faraday adapter for MyAdapter' - spec.homepage = 'https://github.com/lostisland/faraday-my_adapter' + spec.name = 'faraday-excon' + spec.version = Faraday::Excon::VERSION + spec.authors = ['Mattia Giuffrida'] + spec.email = ['giuffrida.mattia@gmail.com'] + + spec.summary = 'Faraday adapter for Excon' + spec.description = 'Faraday adapter for Excon' + spec.homepage = 'https://github.com/lostisland/faraday-excon' spec.license = 'MIT' spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0') spec.metadata['homepage_uri'] = spec.homepage - spec.metadata['source_code_uri'] = 'https://github.com/lostisland/faraday-my_adapter' - spec.metadata['changelog_uri'] = 'https://github.com/lostisland/faraday-my_adapter' + spec.metadata['source_code_uri'] = 'https://github.com/lostisland/faraday-excon' + spec.metadata['changelog_uri'] = 'https://github.com/lostisland/faraday-excon' spec.files = Dir.glob('lib/**/*') + %w[README.md LICENSE.md] spec.require_paths = ['lib'] - spec.add_development_dependency 'faraday', '~> 1.0' + spec.add_dependency 'excon', '>= 0.27.4' spec.add_development_dependency 'bundler', '~> 2.0' + spec.add_development_dependency 'faraday', '~> 1.0' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'simplecov', '~> 0.19.0' spec.add_development_dependency 'multipart-parser', '~> 0.1.1' spec.add_development_dependency 'webmock', '~> 3.4' + + spec.add_development_dependency 'rubocop', '~> 0.91.1' + spec.add_development_dependency 'rubocop-packaging', '~> 0.5' + spec.add_development_dependency 'rubocop-performance', '~> 1.0' end diff --git a/lib/faraday/adapter/excon.rb b/lib/faraday/adapter/excon.rb new file mode 100644 index 0000000..7febdf9 --- /dev/null +++ b/lib/faraday/adapter/excon.rb @@ -0,0 +1,124 @@ +# frozen_string_literal: true + +module Faraday + class Adapter + # Excon adapter. + class Excon < Faraday::Adapter + dependency 'excon' + + def build_connection(env) + opts = opts_from_env(env) + ::Excon.new(env[:url].to_s, opts.merge(@connection_options)) + end + + def call(env) + super + + req_opts = { + method: env[:method].to_s.upcase, + headers: env[:request_headers], + body: read_body(env) + } + + req = env[:request] + if req&.stream_response? + total = 0 + req_opts[:response_block] = lambda do |chunk, _remain, _total| + req.on_data.call(chunk, total += chunk.size) + end + end + + resp = connection(env) { |http| http.request(req_opts) } + save_response(env, resp.status.to_i, resp.body, resp.headers, + resp.reason_phrase) + + @app.call(env) + rescue ::Excon::Errors::SocketError => e + raise Faraday::TimeoutError, e if e.message.match?(/\btimeout\b/) + + raise Faraday::SSLError, e if e.message.match?(/\bcertificate\b/) + + raise Faraday::ConnectionFailed, e + rescue ::Excon::Errors::Timeout => e + raise Faraday::TimeoutError, e + end + + # TODO: support streaming requests + def read_body(env) + env[:body].respond_to?(:read) ? env[:body].read : env[:body] + end + + private + + def opts_from_env(env) + opts = {} + amend_opts_with_ssl!(opts, env[:ssl]) if needs_ssl_settings?(env) + + if (req = env[:request]) + amend_opts_with_timeouts!(opts, req) + amend_opts_with_proxy_settings!(opts, req) + end + + opts + end + + def needs_ssl_settings?(env) + env[:url].scheme == 'https' && env[:ssl] + end + + OPTS_KEYS = [ + %i[client_cert client_cert], + %i[client_key client_key], + %i[certificate certificate], + %i[private_key private_key], + %i[ssl_ca_path ca_path], + %i[ssl_ca_file ca_file], + %i[ssl_version version], + %i[ssl_min_version min_version], + %i[ssl_max_version max_version] + ].freeze + + def amend_opts_with_ssl!(opts, ssl) + opts[:ssl_verify_peer] = !!ssl.fetch(:verify, true) + # https://github.com/geemus/excon/issues/106 + # https://github.com/jruby/jruby-ossl/issues/19 + opts[:nonblock] = false + + OPTS_KEYS.each do |(key_in_opts, key_in_ssl)| + next unless ssl[key_in_ssl] + + opts[key_in_opts] = ssl[key_in_ssl] + end + end + + def amend_opts_with_timeouts!(opts, req) + if (sec = request_timeout(:read, req)) + opts[:read_timeout] = sec + end + + if (sec = request_timeout(:write, req)) + opts[:write_timeout] = sec + end + + return unless (sec = request_timeout(:open, req)) + + opts[:connect_timeout] = sec + end + + def amend_opts_with_proxy_settings!(opts, req) + opts[:proxy] = proxy_settings_for_opts(req[:proxy]) if req[:proxy] + end + + def proxy_settings_for_opts(proxy) + { + host: proxy[:uri].host, + hostname: proxy[:uri].hostname, + port: proxy[:uri].port, + scheme: proxy[:uri].scheme, + user: proxy[:user], + password: proxy[:password] + } + end + end + end +end diff --git a/lib/faraday/adapter/my_adapter.rb b/lib/faraday/adapter/my_adapter.rb deleted file mode 100644 index 0a667f9..0000000 --- a/lib/faraday/adapter/my_adapter.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -module Faraday - class Adapter - # This class provides the main implementation for your adapter. - # There are some key responsibilities that your adapter should satisfy: - # * Initialize and store internally the client you chose (e.g. Net::HTTP) - # * Process requests and save the response (see `#call`) - class MyAdapter < Faraday::Adapter - # The initialize method is lazy-called ONCE when the connection stack is built. - # See https://github.com/lostisland/faraday/blob/master/lib/faraday/rack_builder.rb - # - # @param app [#call] the "rack app" wrapped in middleware. See https://github.com/lostisland/faraday/blob/master/lib/faraday/rack_builder.rb#L157 - # @param opts [Hash] the options hash with all the options necessary for the adapter to correctly configure itself. - # These are automatically stored into `@connection_options` when you call `super`. - # @param block [Proc] the configuration block for the adapter. This usually provides the possibility to access the internal client from the outside - # and set properties that are not included in Faraday's API. It's automatically stored into `@config_block` when you call `super`. - def initialize(app = nil, opts = {}, &block) - super(app, opts, &block) - end - - # This is the main method in your adapter. Since an adapter is a middleware, this method will be called FOR EVERY REQUEST. - # The main task of this method is to perform a call using the internal client and save the response. - # Since this method is not called directly f`rom the outside, you'll need to use `env` in order to: - # * Get the request parameters (see `Faraday::Env` and `Faraday::RequestOptions` for the full list). This includes processing: - # * The request method, url, headers, parameters and body - # * The SSL configuration (env[:ssl]) - # * The request configuration (env[:request]), i.e. things like: timeout, proxy, etc... - # * Set the response attributes. This can be done easily by calling `save_response`. These include: - # * Response headers and body - # * Response status and reason_phrase - # - # @param env [Faraday::Env] the environment of the request being processed - def call(env) - # First thing to do should be to call `super`. This will take care of the following for you: - # * Clear the body if the request supports a body - # * Initialize `env.response` to a `Faraday::Response` - super - - # Next you want to configure your client for the request and perform it, obtaining the response. - response = {} # Make call using client - - # Now that you got the response in the client's format, you need to call `save_response` to store the necessary - # details into the `env`. This method accepts a block to make it easier for you to set response headers using - # `Faraday::Utils::Headers`. Simply provide a block that given a `response_headers` hash sets the necessary key/value pairs. - # Faraday will automatically take care of things like capitalising keys and coercing values. - save_response(env, response.status, response.body, response.headers, response.reason_phrase) do |response_headers| - response.headers.each do |key, value| - response_headers[key] = value - end - end - - # NOTE: An adapter `call` MUST return the `env.response`. If `save_response` is the last line in your `call` - # method implementation, it will automatically return the response for you. - # Otherwise, you'll need to manually do so. You can do this with any (not both) of the following lines: - # * @app.call(env) - # * env.response - # Finally, it's good practice to rescue client-specific exceptions (e.g. Timeout, ConnectionFailed, etc...) - # and re-raise them as Faraday Errors. Check `Faraday::Error` for a list of all errors. - rescue MyAdapterTimeout => e - # Most errors allow you to provide the original exception and optionally (if available) the response, to - # make them available outside of the middleware stack. - raise Faraday::TimeoutError, e - end - end - end -end diff --git a/lib/faraday/excon.rb b/lib/faraday/excon.rb new file mode 100644 index 0000000..d1448fe --- /dev/null +++ b/lib/faraday/excon.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require_relative 'adapter/excon' +require_relative 'excon/version' + +module Faraday + # Main Faraday::Excon module + module Excon + Faraday::Adapter.register_middleware(excon: Faraday::Adapter::Excon) + end +end diff --git a/lib/faraday/my_adapter/version.rb b/lib/faraday/excon/version.rb similarity index 57% rename from lib/faraday/my_adapter/version.rb rename to lib/faraday/excon/version.rb index b19a19b..92dcf49 100644 --- a/lib/faraday/my_adapter/version.rb +++ b/lib/faraday/excon/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Faraday - module MyAdapter - VERSION = '0.1.0' + module Excon + VERSION = '1.0.0' end end diff --git a/lib/faraday/my_adapter.rb b/lib/faraday/my_adapter.rb deleted file mode 100644 index 4bfead3..0000000 --- a/lib/faraday/my_adapter.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require_relative 'adapter/my_adapter' -require_relative 'my_adapter/version' - -module Faraday - module MyAdapter - # Faraday allows you to register your middleware for easier configuration. - # This step is totally optional, but it basically allows users to use a custom symbol (in this case, `:my_adapter`), - # to use your adapter in their connections. - # After calling this line, the following are both valid ways to set the adapter in a connection: - # * conn.adapter Faraday::Adapter::MyAdapter - # * conn.adapter :my_adapter - # Without this line, only the former method is valid. - Faraday::Adapter.register_middleware(my_adapter: Faraday::Adapter::MyAdapter) - end -end diff --git a/spec/faraday/adapter/excon_spec.rb b/spec/faraday/adapter/excon_spec.rb new file mode 100644 index 0000000..d80abc3 --- /dev/null +++ b/spec/faraday/adapter/excon_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +RSpec.describe Faraday::Adapter::Excon do + features :request_body_on_query_methods, :reason_phrase_parse, :trace_method + + it_behaves_like 'an adapter' + + it 'allows to provide adapter specific configs' do + url = URI('https://example.com:1234') + + adapter = described_class.new(nil, debug_request: true) + + conn = adapter.build_connection(url: url) + + expect(conn.data[:debug_request]).to be_truthy + end + + context 'config' do + let(:adapter) { Faraday::Adapter::Excon.new } + let(:request) { Faraday::RequestOptions.new } + let(:uri) { URI.parse('https://example.com') } + let(:env) { { request: request, url: uri } } + + it 'sets timeout' do + request.timeout = 5 + options = adapter.send(:opts_from_env, env) + expect(options[:read_timeout]).to eq(5) + expect(options[:write_timeout]).to eq(5) + expect(options[:connect_timeout]).to eq(5) + end + + it 'sets timeout and open_timeout' do + request.timeout = 5 + request.open_timeout = 3 + options = adapter.send(:opts_from_env, env) + expect(options[:read_timeout]).to eq(5) + expect(options[:write_timeout]).to eq(5) + expect(options[:connect_timeout]).to eq(3) + end + + it 'sets open_timeout' do + request.open_timeout = 3 + options = adapter.send(:opts_from_env, env) + expect(options[:read_timeout]).to eq(nil) + expect(options[:write_timeout]).to eq(nil) + expect(options[:connect_timeout]).to eq(3) + end + end +end diff --git a/spec/faraday/adapter/my_adapter_spec.rb b/spec/faraday/adapter/my_adapter_spec.rb deleted file mode 100644 index 899bf56..0000000 --- a/spec/faraday/adapter/my_adapter_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Faraday::Adapter::MyAdapter do - # Since not all adapters support all the features Faraday has to offer, you can use the `features` method to turn on - # only the ones you know you can support. - # TODO: provide the full list of available features! - features :request_body_on_query_methods, - :reason_phrase_parse, - :compression, - :streaming, - :trace_method - - # Runs the tests provide by Faraday, according to the features specified above. - it_behaves_like 'an adapter' - - # You can then add any other test specific to this adapter here... -end diff --git a/spec/faraday/excon_spec.rb b/spec/faraday/excon_spec.rb new file mode 100644 index 0000000..b87d6b3 --- /dev/null +++ b/spec/faraday/excon_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +RSpec.describe Faraday::Excon do + it 'has a version number' do + expect(Faraday::Excon::VERSION).to be_a(String) + end +end diff --git a/spec/faraday/my_adapter_spec.rb b/spec/faraday/my_adapter_spec.rb deleted file mode 100644 index 81443ef..0000000 --- a/spec/faraday/my_adapter_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Faraday::MyAdapter do - it 'has a version number' do - expect(Faraday::MyAdapter::VERSION).to be_a(String) - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 182ab28..489bd42 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true require 'faraday' -require 'faraday/my_adapter' -# This is the magic bit. It requires a tests suite from the Faraday gem that you can run against your adapter +require 'faraday/excon' require 'faraday_specs_setup' RSpec.configure do |config|