webmock 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.2
4
+
5
+ * Redefined `const_get` and `constants` methods on the replaced `Net::HTTP` to return same values as original `Net::HTTP`
6
+
3
7
  ## 1.7.1
4
8
 
5
9
  * Redefined `const_defined?` on the replaced `Net::HTTP` so that it returns true if constant is defined on the original `Net::HTTP`. This fixes problems with `"Net::HTTP::Get".constantize`.
@@ -75,10 +75,28 @@ module Net #:nodoc: all
75
75
  alias_method :socket_type_without_webmock, :socket_type
76
76
  alias_method :socket_type, :socket_type_with_webmock
77
77
 
78
- if ::RUBY_VERSION =~ /1.8/
78
+ if Module.method(:const_defined?).arity == 1
79
79
  def const_defined?(name)
80
80
  super || self.superclass.const_defined?(name)
81
81
  end
82
+ else
83
+ def const_defined?(name, inherit=true)
84
+ super || self.superclass.const_defined?(name, inherit)
85
+ end
86
+ end
87
+
88
+ if Module.method(:const_get).arity != 1
89
+ def const_get(name, inherit=true)
90
+ super
91
+ rescue NameError
92
+ self.superclass.const_get(name, inherit)
93
+ end
94
+ end
95
+
96
+ if Module.method(:constants).arity != 0
97
+ def constants(inherit=true)
98
+ super + self.superclass.constants(inherit)
99
+ end
82
100
  end
83
101
  end
84
102
 
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '1.7.1' unless defined?(::WebMock::VERSION)
2
+ VERSION = '1.7.2' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -11,8 +11,36 @@ describe "Webmock with Net:HTTP" do
11
11
 
12
12
  let(:port){ WebMockServer.instance.port }
13
13
 
14
- it "should still have const Get defined on replaced Net::HTTP" do
15
- Object.const_get("Net").const_get("HTTP").const_defined?("Get").should be_true
14
+ describe "constants" do
15
+ it "should still have const Get defined on replaced Net::HTTP" do
16
+ Object.const_get("Net").const_get("HTTP").const_defined?("Get").should be_true
17
+ end
18
+
19
+ it "should still have const Get within constants on replaced Net::HTTP" do
20
+ Object.const_get("Net").const_get("HTTP").constants.map(&:to_s).should include("Get")
21
+ end
22
+
23
+ it "should still have const Get within constants on replaced Net::HTTP" do
24
+ Object.const_get("Net").const_get("HTTP").const_get("Get").should_not be_nil
25
+ end
26
+
27
+ if Module.method(:const_defined?).arity != 1
28
+ it "should still have const Get defined (and not inherited) on replaced Net::HTTP" do
29
+ Object.const_get("Net").const_get("HTTP").const_defined?("Get", false).should be_true
30
+ end
31
+ end
32
+
33
+ if Module.method(:const_get).arity != 1
34
+ it "should still be able to get non inherited constant Get on replaced Net::HTTP" do
35
+ Object.const_get("Net").const_get("HTTP").const_get("Get", false).should_not be_nil
36
+ end
37
+ end
38
+
39
+ if Module.method(:constants).arity != 0
40
+ it "should still Get within non inherited constants on replaced Net::HTTP" do
41
+ Object.const_get("Net").const_get("HTTP").constants(false).map(&:to_s).should include("Get")
42
+ end
43
+ end
16
44
  end
17
45
 
18
46
  it "should work with block provided" do
metadata CHANGED
@@ -1,200 +1,137 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
- version: !ruby/object:Gem::Version
4
- hash: 9
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.2
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 7
9
- - 1
10
- version: 1.7.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Bartosz Blimke
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-08-15 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: addressable
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2152397720 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 7
29
- segments:
30
- - 2
31
- - 2
32
- version: "2.2"
33
- - - ">"
34
- - !ruby/object:Gem::Version
35
- hash: 13
36
- segments:
37
- - 2
38
- - 2
39
- - 5
20
+ - !ruby/object:Gem::Version
21
+ version: '2.2'
22
+ - - ! '>'
23
+ - !ruby/object:Gem::Version
40
24
  version: 2.2.5
41
25
  type: :runtime
42
- version_requirements: *id001
43
- - !ruby/object:Gem::Dependency
44
- name: crack
45
26
  prerelease: false
46
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ version_requirements: *2152397720
28
+ - !ruby/object:Gem::Dependency
29
+ name: crack
30
+ requirement: &2152396440 !ruby/object:Gem::Requirement
47
31
  none: false
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- hash: 21
52
- segments:
53
- - 0
54
- - 1
55
- - 7
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
56
35
  version: 0.1.7
57
36
  type: :runtime
58
- version_requirements: *id002
59
- - !ruby/object:Gem::Dependency
60
- name: rspec
61
37
  prerelease: false
62
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ version_requirements: *2152396440
39
+ - !ruby/object:Gem::Dependency
40
+ name: rspec
41
+ requirement: &2152395720 !ruby/object:Gem::Requirement
63
42
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 15
68
- segments:
69
- - 2
70
- - 0
71
- - 0
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
72
46
  version: 2.0.0
73
47
  type: :development
74
- version_requirements: *id003
75
- - !ruby/object:Gem::Dependency
76
- name: httpclient
77
48
  prerelease: false
78
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ version_requirements: *2152395720
50
+ - !ruby/object:Gem::Dependency
51
+ name: httpclient
52
+ requirement: &2152395000 !ruby/object:Gem::Requirement
79
53
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 119
84
- segments:
85
- - 2
86
- - 1
87
- - 5
88
- - 2
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
89
57
  version: 2.1.5.2
90
58
  type: :development
91
- version_requirements: *id004
92
- - !ruby/object:Gem::Dependency
93
- name: patron
94
59
  prerelease: false
95
- requirement: &id005 !ruby/object:Gem::Requirement
60
+ version_requirements: *2152395000
61
+ - !ruby/object:Gem::Dependency
62
+ name: patron
63
+ requirement: &2152393780 !ruby/object:Gem::Requirement
96
64
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 29
101
- segments:
102
- - 0
103
- - 4
104
- - 9
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
105
68
  version: 0.4.9
106
69
  type: :development
107
- version_requirements: *id005
108
- - !ruby/object:Gem::Dependency
109
- name: em-http-request
110
70
  prerelease: false
111
- requirement: &id006 !ruby/object:Gem::Requirement
71
+ version_requirements: *2152393780
72
+ - !ruby/object:Gem::Dependency
73
+ name: em-http-request
74
+ requirement: &2152393200 !ruby/object:Gem::Requirement
112
75
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 11
117
- segments:
118
- - 0
119
- - 2
120
- - 14
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
121
79
  version: 0.2.14
122
80
  type: :development
123
- version_requirements: *id006
124
- - !ruby/object:Gem::Dependency
125
- name: curb
126
81
  prerelease: false
127
- requirement: &id007 !ruby/object:Gem::Requirement
82
+ version_requirements: *2152393200
83
+ - !ruby/object:Gem::Dependency
84
+ name: curb
85
+ requirement: &2152391900 !ruby/object:Gem::Requirement
128
86
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 19
133
- segments:
134
- - 0
135
- - 7
136
- - 8
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
137
90
  version: 0.7.8
138
91
  type: :development
139
- version_requirements: *id007
140
- - !ruby/object:Gem::Dependency
141
- name: typhoeus
142
92
  prerelease: false
143
- requirement: &id008 !ruby/object:Gem::Requirement
93
+ version_requirements: *2152391900
94
+ - !ruby/object:Gem::Dependency
95
+ name: typhoeus
96
+ requirement: &2152373560 !ruby/object:Gem::Requirement
144
97
  none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: 31
149
- segments:
150
- - 0
151
- - 2
152
- - 4
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
153
101
  version: 0.2.4
154
102
  type: :development
155
- version_requirements: *id008
156
- - !ruby/object:Gem::Dependency
157
- name: minitest
158
103
  prerelease: false
159
- requirement: &id009 !ruby/object:Gem::Requirement
104
+ version_requirements: *2152373560
105
+ - !ruby/object:Gem::Dependency
106
+ name: minitest
107
+ requirement: &2152372620 !ruby/object:Gem::Requirement
160
108
  none: false
161
- requirements:
162
- - - ">="
163
- - !ruby/object:Gem::Version
164
- hash: 3
165
- segments:
166
- - 2
167
- - 2
168
- - 2
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
169
112
  version: 2.2.2
170
113
  type: :development
171
- version_requirements: *id009
172
- - !ruby/object:Gem::Dependency
173
- name: rdoc
174
114
  prerelease: false
175
- requirement: &id010 !ruby/object:Gem::Requirement
115
+ version_requirements: *2152372620
116
+ - !ruby/object:Gem::Dependency
117
+ name: rdoc
118
+ requirement: &2152371780 !ruby/object:Gem::Requirement
176
119
  none: false
177
- requirements:
178
- - - ">"
179
- - !ruby/object:Gem::Version
180
- hash: 19
181
- segments:
182
- - 3
183
- - 5
184
- - 0
120
+ requirements:
121
+ - - ! '>'
122
+ - !ruby/object:Gem::Version
185
123
  version: 3.5.0
186
124
  type: :development
187
- version_requirements: *id010
188
- description: WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.
189
- email:
125
+ prerelease: false
126
+ version_requirements: *2152371780
127
+ description: WebMock allows stubbing HTTP requests and setting expectations on HTTP
128
+ requests.
129
+ email:
190
130
  - bartosz.blimke@gmail.com
191
131
  executables: []
192
-
193
132
  extensions: []
194
-
195
133
  extra_rdoc_files: []
196
-
197
- files:
134
+ files:
198
135
  - .gemtest
199
136
  - .gitignore
200
137
  - .rvmrc
@@ -306,38 +243,29 @@ files:
306
243
  - webmock.gemspec
307
244
  homepage: http://github.com/bblimke/webmock
308
245
  licenses: []
309
-
310
246
  post_install_message:
311
247
  rdoc_options: []
312
-
313
- require_paths:
248
+ require_paths:
314
249
  - lib
315
- required_ruby_version: !ruby/object:Gem::Requirement
250
+ required_ruby_version: !ruby/object:Gem::Requirement
316
251
  none: false
317
- requirements:
318
- - - ">="
319
- - !ruby/object:Gem::Version
320
- hash: 3
321
- segments:
322
- - 0
323
- version: "0"
324
- required_rubygems_version: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ! '>='
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
256
+ required_rubygems_version: !ruby/object:Gem::Requirement
325
257
  none: false
326
- requirements:
327
- - - ">="
328
- - !ruby/object:Gem::Version
329
- hash: 3
330
- segments:
331
- - 0
332
- version: "0"
258
+ requirements:
259
+ - - ! '>='
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
333
262
  requirements: []
334
-
335
263
  rubyforge_project: webmock
336
264
  rubygems_version: 1.8.6
337
265
  signing_key:
338
266
  specification_version: 3
339
267
  summary: Library for stubbing HTTP requests in Ruby.
340
- test_files:
268
+ test_files:
341
269
  - spec/curb_spec.rb
342
270
  - spec/curb_spec_helper.rb
343
271
  - spec/em_http_request_spec.rb