Skip to content

Commit

Permalink
Support standalone adapters (#941)
Browse files Browse the repository at this point in the history
* Expose relevant specs to external adapters
  • Loading branch information
iMacTia authored and olleolleolle committed Mar 10, 2019
1 parent 6ff61c0 commit 14b596f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
4 changes: 3 additions & 1 deletion faraday.gemspec
Expand Up @@ -20,5 +20,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'multipart-post', '>= 1.2', '< 3'

spec.files = `git ls-files -z lib LICENSE.md README.md`.split("\0")
spec.require_paths = %w[lib spec/external_adapters]
spec.files = `git ls-files -z lib spec/external_adapters`.split("\0")
spec.files += %w[LICENSE.md README.md]
end
14 changes: 14 additions & 0 deletions spec/external_adapters/faraday_specs_setup.rb
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)

require_relative '../support/helper_methods'
require_relative '../support/disabling_stub'
require_relative '../support/streaming_response_checker'
require_relative '../support/shared_examples/adapter'
require_relative '../support/shared_examples/request_method'

RSpec.configure do |config|
config.include Faraday::HelperMethods
end
13 changes: 0 additions & 13 deletions spec/spec_helper.rb
Expand Up @@ -130,16 +130,3 @@ def dump_pending(_arg); end

RSpec::Core::Formatters::DocumentationFormatter.prepend self
end

# Allows to disable WebMock stubs
module DisablingStub
def disable
@disabled = true
end

def disabled?
@disabled
end

WebMock::RequestStub.prepend self
end
14 changes: 14 additions & 0 deletions spec/support/disabling_stub.rb
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# Allows to disable WebMock stubs
module DisablingStub
def disable
@disabled = true
end

def disabled?
@disabled
end

WebMock::RequestStub.prepend self
end

0 comments on commit 14b596f

Please sign in to comment.