Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

remove Faraday.register_middleware

  • Loading branch information...
commit 14b458a9c971897f44d5ee3ba5354de52c998e72 1 parent 91dfa11
risk danger olson authored

Showing 2 changed files with 2 additions and 35 deletions. Show diff stats Hide diff stats

  1. +0 23 lib/faraday.rb
  2. +2 12 test/middleware_stack_test.rb
23 lib/faraday.rb
@@ -215,29 +215,6 @@ def all_loaded_constants
215 215 end
216 216 end
217 217
218   - # Public: Register middleware classes under a short name.
219   - #
220   - # type - A Symbol specifying the kind of middleware (default: :middleware)
221   - # mapping - A Hash mapping Symbol keys to classes. Classes can be expressed
222   - # as fully qualified constant, or a Proc that will be lazily called
223   - # to return the former.
224   - #
225   - # Examples
226   - #
227   - # Faraday.register_middleware :aloha => MyModule::Aloha
228   - # Faraday.register_middleware :response, :boom => MyModule::Boom
229   - #
230   - # # shortcuts are now available in Builder:
231   - # builder.use :aloha
232   - # builder.response :boom
233   - #
234   - # Returns nothing.
235   - def self.register_middleware(type, mapping = nil)
236   - type, mapping = :middleware, type if mapping.nil?
237   - component = self.const_get(type.to_s.capitalize)
238   - component.register_middleware(mapping)
239   - end
240   -
241 218 require_libs "utils", "connection", "builder", "parameters", "middleware",
242 219 "adapter", "request", "response", "upload_io", "error"
243 220 end
14 test/middleware_stack_test.rb
@@ -104,7 +104,7 @@ def test_unregistered_symbol
104 104 end
105 105
106 106 def test_registered_symbol
107   - Faraday.register_middleware :apple => Apple
  107 + Faraday::Middleware.register_middleware :apple => Apple
108 108 begin
109 109 build_stack :apple
110 110 assert_handlers %w[Apple]
@@ -114,7 +114,7 @@ def test_registered_symbol
114 114 end
115 115
116 116 def test_registered_symbol_with_proc
117   - Faraday.register_middleware :apple => lambda { Apple }
  117 + Faraday::Middleware.register_middleware :apple => lambda { Apple }
118 118 begin
119 119 build_stack :apple
120 120 assert_handlers %w[Apple]
@@ -123,16 +123,6 @@ def test_registered_symbol_with_proc
123 123 end
124 124 end
125 125
126   - def test_registered_symbol_with_type
127   - Faraday.register_middleware :request, :orange => Orange
128   - begin
129   - build_stack {|b| b.request :orange }
130   - assert_handlers %w[Orange]
131   - ensure
132   - unregister_middleware Faraday::Request, :orange
133   - end
134   - end
135   -
136 126 def test_missing_dependencies
137 127 build_stack Broken
138 128 err = assert_raises RuntimeError do

0 comments on commit 14b458a

Please sign in to comment.
Something went wrong with that request. Please try again.