faraday 0.17.3 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/faraday.rb +1 -1
- data/lib/faraday/adapter/net_http.rb +1 -0
- data/lib/faraday/deprecate.rb +3 -1
- data/spec/faraday/deprecate_spec.rb +78 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b53b5c1f4239a1b798cc39d21c2ba204f1f1682c68650dfd5abd2a15acad8f4c
|
4
|
+
data.tar.gz: 494d3b48b2b5cbd07433d786e3dcac4570c5a8319b6bdbbba481957ec18ad667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e473d6f5f690de91f62283db0364e3a304077dd3445b924a9636a7691593d8d7abf715d5e1ccd7838364a85d4e8611bc4c7d6ab1195b5f0c30d24e32a9d6946c
|
7
|
+
data.tar.gz: 84f629bd1dce5dc09637fec05c46d8f78d018b7f89adc4b7a945e50f3edc0cc2077733ca74b41b92e5afb02876f25168b6e40832cf40bebe5c9b63d53fe6a9ac
|
data/lib/faraday.rb
CHANGED
data/lib/faraday/deprecate.rb
CHANGED
@@ -9,11 +9,13 @@ module Faraday
|
|
9
9
|
module DeprecatedClass
|
10
10
|
def self.proxy_class(origclass, ver = '1.0')
|
11
11
|
proxy = Class.new(origclass) do
|
12
|
+
const_set("ORIG_CLASS", origclass)
|
13
|
+
|
12
14
|
class << self
|
13
15
|
extend Faraday::Deprecate
|
14
16
|
|
15
17
|
def ===(other)
|
16
|
-
other.is_a?(superclass) || super
|
18
|
+
(superclass == const_get("ORIG_CLASS") && other.is_a?(superclass)) || super
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -56,6 +56,84 @@ RSpec.describe Faraday::DeprecatedClass do
|
|
56
56
|
expect { raise SampleDeprecatedClass, nil }.to raise_error(SampleClass)
|
57
57
|
end
|
58
58
|
|
59
|
+
describe 'match behavior' do
|
60
|
+
class SampleDeprecatedClassA < SampleDeprecatedClass; end
|
61
|
+
class SampleDeprecatedClassB < SampleDeprecatedClass; end
|
62
|
+
|
63
|
+
class SampleDeprecatedClassAX < SampleDeprecatedClassA; end
|
64
|
+
|
65
|
+
class SampleClassA < SampleClass; end
|
66
|
+
|
67
|
+
describe 'undeprecated class' do
|
68
|
+
it 'is === to instance of deprecated class' do
|
69
|
+
expect(SampleClass === SampleDeprecatedClass.new).to be true
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'is === to instance of subclass of deprecated class' do
|
73
|
+
expect(SampleClass === SampleDeprecatedClassA.new).to be true
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'is === to instance of subclass of subclass of deprecated class' do
|
77
|
+
expect(SampleClass === SampleDeprecatedClassAX.new).to be true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'subclass of undeprecated class' do
|
82
|
+
it 'is not === to instance of undeprecated class' do
|
83
|
+
expect(SampleClassA === SampleClass.new).to be false
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'is not === to instance of deprecated class' do
|
87
|
+
expect(SampleClassA === SampleDeprecatedClass.new).to be false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe 'deprecated class' do
|
92
|
+
it 'is === to instance of undeprecated class' do
|
93
|
+
expect(SampleDeprecatedClass === SampleClass.new).to be true
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'is === to instance of subclass of undeprecated class' do
|
97
|
+
expect(SampleDeprecatedClass === SampleClassA.new).to be true
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'is === to instance of subclass of deprecated class' do
|
101
|
+
expect(SampleDeprecatedClass === SampleDeprecatedClassA.new).to be true
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'is === to instance of subclass of subclass of deprecated class' do
|
105
|
+
expect(SampleDeprecatedClass === SampleDeprecatedClassAX.new).to be true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe 'subclass of deprecated class' do
|
110
|
+
it 'is not === to instance of subclass of undeprecated class' do
|
111
|
+
expect(SampleDeprecatedClassA === SampleClass.new).to be false
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'is not === to instance of another subclass of deprecated class' do
|
115
|
+
expect(SampleDeprecatedClassA === SampleDeprecatedClassB.new).to be false
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'is === to instance of its subclass' do
|
119
|
+
expect(SampleDeprecatedClassA === SampleDeprecatedClassAX.new).to be true
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'is === to instance of deprecated class' do
|
123
|
+
expect(SampleDeprecatedClass === SampleDeprecatedClassB.new).to be true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe 'subclass of subclass of deprecated class' do
|
128
|
+
it 'is not === to instance of subclass of another subclass of deprecated class' do
|
129
|
+
expect(SampleDeprecatedClassAX === SampleDeprecatedClassB.new).to be false
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'is not === to instance of its superclass' do
|
133
|
+
expect(SampleDeprecatedClassA === SampleDeprecatedClass.new).to be false
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
59
137
|
|
60
138
|
def with_warn_squelching
|
61
139
|
stderr_catcher = StringIO.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@technoweenie"
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-02-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multipart-post
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.2.3
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: HTTP/REST API client library.
|