webmock 1.6.2 → 1.6.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.
@@ -10,6 +10,7 @@ module PatronSpecHelper
10
10
 
11
11
  sess.connect_timeout = 10
12
12
  sess.timeout = 10
13
+ sess.max_redirects = 0
13
14
 
14
15
  response = sess.request(method, "#{uri.path}#{uri.query ? '?' : ''}#{uri.query}", options[:headers] || {}, {
15
16
  :data => options[:body]
@@ -145,7 +145,7 @@ describe WebMock::RequestPattern do
145
145
  WebMock::RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
146
146
  should_not match(WebMock::RequestSignature.new(:get, "www.example.com?x[]=b&a[]=c"))
147
147
  end
148
-
148
+
149
149
  it "should match for query params are the same as declared as string" do
150
150
  WebMock::RequestPattern.new(:get, "www.example.com", :query => "a[]=b&a[]=c").
151
151
  should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
@@ -224,6 +224,15 @@ describe WebMock::RequestPattern do
224
224
  should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'foo bar'))
225
225
  end
226
226
 
227
+ it "should match when hash contains regex values" do
228
+ WebMock::RequestPattern.new(:post, "www.example.com", :body => {:a => /^\w{5}$/, :b => {:c => /^\d{3}$/}}).
229
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=abcde&b[c]=123'))
230
+ end
231
+
232
+ it "should not match when hash does not contains regex values" do
233
+ WebMock::RequestPattern.new(:post, "www.example.com", :body => {:a => /^\d+$/, :b => {:c => /^\d{3}$/}}).
234
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=abcde&b[c]=123'))
235
+ end
227
236
  end
228
237
 
229
238
  describe "for request with json body and content type is set to json" do
data/spec/spec_helper.rb CHANGED
@@ -23,6 +23,9 @@ RSpec.configure do |config|
23
23
  if ENV["NO_CONNECTION"] || no_network_connection
24
24
  config.filter_run_excluding :net_connect => true
25
25
  end
26
+
27
+ config.filter_run :focus => true
28
+ config.run_all_when_everything_filtered = true
26
29
  end
27
30
 
28
31
  def fail()
@@ -42,8 +45,8 @@ end
42
45
  def setup_expectations_for_real_example_com_request(options = {})
43
46
  defaults = { :host => "www.example.com", :port => 80, :method => "GET",
44
47
  :path => "/",
45
- :response_code => 200, :response_message => "OK",
46
- :response_body => "<title>example</title>" }
48
+ :response_code => 302, :response_message => "Found",
49
+ :response_body => "" }
47
50
  setup_expectations_for_real_request(defaults.merge(options))
48
51
  end
49
52
 
@@ -4,20 +4,17 @@ unless defined? SAMPLE_HEADERS
4
4
  SAMPLE_HEADERS = { "Content-Length" => "8888", "Accept" => "application/json" }
5
5
  ESCAPED_PARAMS = "x=ab%20c&z=%27Stop%21%27%20said%20Fred"
6
6
  NOT_ESCAPED_PARAMS = "z='Stop!' said Fred&x=ab c"
7
- WWW_EXAMPLE_COM_CONTENT_LENGTH = 596
7
+ WWW_EXAMPLE_COM_CONTENT_LENGTH = 0
8
8
  end
9
9
 
10
10
  class MyException < StandardError; end;
11
11
 
12
12
  describe "WebMock version" do
13
-
14
13
  it "should report version" do
15
- WebMock.version.should == open(File.join(File.dirname(__FILE__), "..", "VERSION")).read.strip
14
+ WebMock.version.should == WebMock::VERSION
16
15
  end
17
-
18
16
  end
19
17
 
20
-
21
18
  shared_examples_for "WebMock" do
22
19
  before(:each) do
23
20
  WebMock.disable_net_connect!
@@ -33,8 +30,7 @@ shared_examples_for "WebMock" do
33
30
 
34
31
  it "should make a real web request if request is not stubbed" do
35
32
  setup_expectations_for_real_example_com_request
36
- http_request(:get, "http://www.example.com/").
37
- body.should =~ /.*example.*/
33
+ http_request(:get, "http://www.example.com/").status.should == "302"
38
34
  end
39
35
 
40
36
  it "should make a real https request if request is not stubbed" do
@@ -42,6 +38,8 @@ shared_examples_for "WebMock" do
42
38
  :host => "www.paypal.com",
43
39
  :port => 443,
44
40
  :path => "/uk/cgi-bin/webscr",
41
+ :response_code => 200,
42
+ :response_message => "OK",
45
43
  :response_body => "hello paypal"
46
44
  )
47
45
  http_request(:get, "https://www.paypal.com/uk/cgi-bin/webscr").
@@ -128,7 +126,7 @@ shared_examples_for "WebMock" do
128
126
  end
129
127
 
130
128
  it "should allow a real request to allowed host", :net_connect => true do
131
- http_request(:get, "http://www.example.org/").status.should == "200"
129
+ http_request(:get, "http://www.example.org/").status.should == "302"
132
130
  end
133
131
  end
134
132
  end
@@ -1493,8 +1491,8 @@ shared_examples_for "WebMock" do
1493
1491
  end
1494
1492
 
1495
1493
  it "should pass response with status and message" do
1496
- @response.status[0].should == 200
1497
- @response.status[1].should == "OK"
1494
+ @response.status[0].should == 302
1495
+ @response.status[1].should == "Found"
1498
1496
  end
1499
1497
 
1500
1498
  it "should pass response with headers" do
data/webmock.gemspec CHANGED
@@ -1,175 +1,32 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'webmock/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{webmock}
8
- s.version = "1.6.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Bartosz Blimke"]
12
- s.date = %q{2011-01-12}
6
+ s.name = 'webmock'
7
+ s.version = WebMock::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Bartosz Blimke']
10
+ s.email = ['bartosz.blimke@gmail.com']
11
+ s.homepage = 'http://github.com/bblimke/webmock'
12
+ s.summary = %q{Library for stubbing HTTP requests in Ruby.}
13
13
  s.description = %q{WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.}
14
- s.email = %q{bartosz.blimke@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "CHANGELOG.md",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/webmock.rb",
27
- "lib/webmock/api.rb",
28
- "lib/webmock/assertion_failure.rb",
29
- "lib/webmock/callback_registry.rb",
30
- "lib/webmock/config.rb",
31
- "lib/webmock/cucumber.rb",
32
- "lib/webmock/deprecation.rb",
33
- "lib/webmock/errors.rb",
34
- "lib/webmock/http_lib_adapters/curb.rb",
35
- "lib/webmock/http_lib_adapters/em_http_request.rb",
36
- "lib/webmock/http_lib_adapters/httpclient.rb",
37
- "lib/webmock/http_lib_adapters/net_http.rb",
38
- "lib/webmock/http_lib_adapters/net_http_response.rb",
39
- "lib/webmock/http_lib_adapters/patron.rb",
40
- "lib/webmock/request_execution_verifier.rb",
41
- "lib/webmock/request_pattern.rb",
42
- "lib/webmock/request_registry.rb",
43
- "lib/webmock/request_signature.rb",
44
- "lib/webmock/request_stub.rb",
45
- "lib/webmock/response.rb",
46
- "lib/webmock/responses_sequence.rb",
47
- "lib/webmock/rspec.rb",
48
- "lib/webmock/rspec/matchers.rb",
49
- "lib/webmock/rspec/matchers/request_pattern_matcher.rb",
50
- "lib/webmock/rspec/matchers/webmock_matcher.rb",
51
- "lib/webmock/stub_registry.rb",
52
- "lib/webmock/stub_request_snippet.rb",
53
- "lib/webmock/test_unit.rb",
54
- "lib/webmock/util/hash_counter.rb",
55
- "lib/webmock/util/hash_keys_stringifier.rb",
56
- "lib/webmock/util/headers.rb",
57
- "lib/webmock/util/uri.rb",
58
- "lib/webmock/webmock.rb",
59
- "spec/curb_spec.rb",
60
- "spec/curb_spec_helper.rb",
61
- "spec/em_http_request_spec.rb",
62
- "spec/em_http_request_spec_helper.rb",
63
- "spec/errors_spec.rb",
64
- "spec/example_curl_output.txt",
65
- "spec/httpclient_spec.rb",
66
- "spec/httpclient_spec_helper.rb",
67
- "spec/net_http_spec.rb",
68
- "spec/net_http_spec_helper.rb",
69
- "spec/network_connection.rb",
70
- "spec/other_net_http_libs_spec.rb",
71
- "spec/patron_spec.rb",
72
- "spec/patron_spec_helper.rb",
73
- "spec/request_execution_verifier_spec.rb",
74
- "spec/request_pattern_spec.rb",
75
- "spec/request_registry_spec.rb",
76
- "spec/request_signature_spec.rb",
77
- "spec/request_stub_spec.rb",
78
- "spec/response_spec.rb",
79
- "spec/spec_helper.rb",
80
- "spec/stub_registry_spec.rb",
81
- "spec/stub_request_snippet_spec.rb",
82
- "spec/util/hash_counter_spec.rb",
83
- "spec/util/hash_keys_stringifier_spec.rb",
84
- "spec/util/headers_spec.rb",
85
- "spec/util/uri_spec.rb",
86
- "spec/vendor/addressable/lib/addressable/uri.rb",
87
- "spec/vendor/addressable/lib/uri.rb",
88
- "spec/vendor/crack/lib/crack.rb",
89
- "spec/vendor/right_http_connection-1.2.4/History.txt",
90
- "spec/vendor/right_http_connection-1.2.4/Manifest.txt",
91
- "spec/vendor/right_http_connection-1.2.4/README.txt",
92
- "spec/vendor/right_http_connection-1.2.4/Rakefile",
93
- "spec/vendor/right_http_connection-1.2.4/lib/net_fix.rb",
94
- "spec/vendor/right_http_connection-1.2.4/lib/right_http_connection.rb",
95
- "spec/vendor/right_http_connection-1.2.4/setup.rb",
96
- "spec/webmock_shared.rb",
97
- "test/test_helper.rb",
98
- "test/test_webmock.rb",
99
- "webmock.gemspec"
100
- ]
101
- s.homepage = %q{http://github.com/bblimke/webmock}
102
- s.rdoc_options = ["--charset=UTF-8"]
103
- s.require_paths = ["lib"]
104
- s.rubygems_version = %q{1.3.7}
105
- s.summary = %q{Library for stubbing HTTP requests in Ruby.}
106
- s.test_files = [
107
- "spec/curb_spec.rb",
108
- "spec/curb_spec_helper.rb",
109
- "spec/em_http_request_spec.rb",
110
- "spec/em_http_request_spec_helper.rb",
111
- "spec/errors_spec.rb",
112
- "spec/httpclient_spec.rb",
113
- "spec/httpclient_spec_helper.rb",
114
- "spec/net_http_spec.rb",
115
- "spec/net_http_spec_helper.rb",
116
- "spec/network_connection.rb",
117
- "spec/other_net_http_libs_spec.rb",
118
- "spec/patron_spec.rb",
119
- "spec/patron_spec_helper.rb",
120
- "spec/request_execution_verifier_spec.rb",
121
- "spec/request_pattern_spec.rb",
122
- "spec/request_registry_spec.rb",
123
- "spec/request_signature_spec.rb",
124
- "spec/request_stub_spec.rb",
125
- "spec/response_spec.rb",
126
- "spec/spec_helper.rb",
127
- "spec/stub_registry_spec.rb",
128
- "spec/stub_request_snippet_spec.rb",
129
- "spec/util/hash_counter_spec.rb",
130
- "spec/util/hash_keys_stringifier_spec.rb",
131
- "spec/util/headers_spec.rb",
132
- "spec/util/uri_spec.rb",
133
- "spec/vendor/addressable/lib/addressable/uri.rb",
134
- "spec/vendor/addressable/lib/uri.rb",
135
- "spec/vendor/crack/lib/crack.rb",
136
- "spec/vendor/right_http_connection-1.2.4/lib/net_fix.rb",
137
- "spec/vendor/right_http_connection-1.2.4/lib/right_http_connection.rb",
138
- "spec/vendor/right_http_connection-1.2.4/setup.rb",
139
- "spec/webmock_shared.rb",
140
- "test/test_helper.rb",
141
- "test/test_webmock.rb"
142
- ]
143
14
 
144
- if s.respond_to? :specification_version then
145
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
146
- s.specification_version = 3
15
+ s.rubyforge_project = 'webmock'
16
+
17
+ s.add_dependency 'addressable', '~> 2.2', '> 2.2.5'
18
+ s.add_dependency 'crack', '>=0.1.7'
19
+ s.add_development_dependency 'rspec', '>= 2.0.0'
20
+ s.add_development_dependency 'httpclient', '>= 2.1.5.2'
147
21
 
148
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
149
- s.add_runtime_dependency(%q<addressable>, [">= 2.2.2"])
150
- s.add_runtime_dependency(%q<crack>, [">= 0.1.7"])
151
- s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
152
- s.add_development_dependency(%q<httpclient>, [">= 2.1.5.2"])
153
- s.add_development_dependency(%q<patron>, [">= 0.4.9"])
154
- s.add_development_dependency(%q<em-http-request>, [">= 0.2.14"])
155
- s.add_development_dependency(%q<curb>, [">= 0.7.8"])
156
- else
157
- s.add_dependency(%q<addressable>, [">= 2.2.2"])
158
- s.add_dependency(%q<crack>, [">= 0.1.7"])
159
- s.add_dependency(%q<rspec>, [">= 2.0.0"])
160
- s.add_dependency(%q<httpclient>, [">= 2.1.5.2"])
161
- s.add_dependency(%q<patron>, [">= 0.4.9"])
162
- s.add_dependency(%q<em-http-request>, [">= 0.2.14"])
163
- s.add_dependency(%q<curb>, [">= 0.7.8"])
164
- end
165
- else
166
- s.add_dependency(%q<addressable>, [">= 2.2.2"])
167
- s.add_dependency(%q<crack>, [">= 0.1.7"])
168
- s.add_dependency(%q<rspec>, [">= 2.0.0"])
169
- s.add_dependency(%q<httpclient>, [">= 2.1.5.2"])
170
- s.add_dependency(%q<patron>, [">= 0.4.9"])
171
- s.add_dependency(%q<em-http-request>, [">= 0.2.14"])
172
- s.add_dependency(%q<curb>, [">= 0.7.8"])
22
+ unless RUBY_PLATFORM =~ /java/
23
+ s.add_development_dependency 'patron', '>= 0.4.9'
24
+ s.add_development_dependency 'em-http-request', '>= 0.2.14'
25
+ s.add_development_dependency 'curb', '>= 0.7.8'
173
26
  end
174
- end
175
27
 
28
+ s.files = `git ls-files`.split("\n")
29
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
31
+ s.require_paths = ['lib']
32
+ end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 6
9
- - 2
10
- version: 1.6.2
4
+ prerelease:
5
+ version: 1.6.4
11
6
  platform: ruby
12
7
  authors:
13
8
  - Bartosz Blimke
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-01-12 00:00:00 +00:00
13
+ date: 2011-05-18 00:00:00 +01:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -24,14 +19,12 @@ dependencies:
24
19
  requirement: &id001 !ruby/object:Gem::Requirement
25
20
  none: false
26
21
  requirements:
27
- - - ">="
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: "2.2"
25
+ - - ">"
28
26
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 2
32
- - 2
33
- - 2
34
- version: 2.2.2
27
+ version: 2.2.5
35
28
  type: :runtime
36
29
  version_requirements: *id001
37
30
  - !ruby/object:Gem::Dependency
@@ -42,11 +35,6 @@ dependencies:
42
35
  requirements:
43
36
  - - ">="
44
37
  - !ruby/object:Gem::Version
45
- hash: 21
46
- segments:
47
- - 0
48
- - 1
49
- - 7
50
38
  version: 0.1.7
51
39
  type: :runtime
52
40
  version_requirements: *id002
@@ -58,11 +46,6 @@ dependencies:
58
46
  requirements:
59
47
  - - ">="
60
48
  - !ruby/object:Gem::Version
61
- hash: 15
62
- segments:
63
- - 2
64
- - 0
65
- - 0
66
49
  version: 2.0.0
67
50
  type: :development
68
51
  version_requirements: *id003
@@ -74,12 +57,6 @@ dependencies:
74
57
  requirements:
75
58
  - - ">="
76
59
  - !ruby/object:Gem::Version
77
- hash: 119
78
- segments:
79
- - 2
80
- - 1
81
- - 5
82
- - 2
83
60
  version: 2.1.5.2
84
61
  type: :development
85
62
  version_requirements: *id004
@@ -91,11 +68,6 @@ dependencies:
91
68
  requirements:
92
69
  - - ">="
93
70
  - !ruby/object:Gem::Version
94
- hash: 29
95
- segments:
96
- - 0
97
- - 4
98
- - 9
99
71
  version: 0.4.9
100
72
  type: :development
101
73
  version_requirements: *id005
@@ -107,11 +79,6 @@ dependencies:
107
79
  requirements:
108
80
  - - ">="
109
81
  - !ruby/object:Gem::Version
110
- hash: 11
111
- segments:
112
- - 0
113
- - 2
114
- - 14
115
82
  version: 0.2.14
116
83
  type: :development
117
84
  version_requirements: *id006
@@ -123,30 +90,26 @@ dependencies:
123
90
  requirements:
124
91
  - - ">="
125
92
  - !ruby/object:Gem::Version
126
- hash: 19
127
- segments:
128
- - 0
129
- - 7
130
- - 8
131
93
  version: 0.7.8
132
94
  type: :development
133
95
  version_requirements: *id007
134
96
  description: WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.
135
- email: bartosz.blimke@gmail.com
97
+ email:
98
+ - bartosz.blimke@gmail.com
136
99
  executables: []
137
100
 
138
101
  extensions: []
139
102
 
140
- extra_rdoc_files:
141
- - LICENSE
142
- - README.md
103
+ extra_rdoc_files: []
104
+
143
105
  files:
144
106
  - .gitignore
107
+ - .rvmrc
145
108
  - CHANGELOG.md
109
+ - Gemfile
146
110
  - LICENSE
147
111
  - README.md
148
112
  - Rakefile
149
- - VERSION
150
113
  - lib/webmock.rb
151
114
  - lib/webmock/api.rb
152
115
  - lib/webmock/assertion_failure.rb
@@ -179,6 +142,7 @@ files:
179
142
  - lib/webmock/util/hash_keys_stringifier.rb
180
143
  - lib/webmock/util/headers.rb
181
144
  - lib/webmock/util/uri.rb
145
+ - lib/webmock/version.rb
182
146
  - lib/webmock/webmock.rb
183
147
  - spec/curb_spec.rb
184
148
  - spec/curb_spec_helper.rb
@@ -226,8 +190,8 @@ homepage: http://github.com/bblimke/webmock
226
190
  licenses: []
227
191
 
228
192
  post_install_message:
229
- rdoc_options:
230
- - --charset=UTF-8
193
+ rdoc_options: []
194
+
231
195
  require_paths:
232
196
  - lib
233
197
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -235,23 +199,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
199
  requirements:
236
200
  - - ">="
237
201
  - !ruby/object:Gem::Version
238
- hash: 3
239
- segments:
240
- - 0
241
202
  version: "0"
242
203
  required_rubygems_version: !ruby/object:Gem::Requirement
243
204
  none: false
244
205
  requirements:
245
206
  - - ">="
246
207
  - !ruby/object:Gem::Version
247
- hash: 3
248
- segments:
249
- - 0
250
208
  version: "0"
251
209
  requirements: []
252
210
 
253
- rubyforge_project:
254
- rubygems_version: 1.3.7
211
+ rubyforge_project: webmock
212
+ rubygems_version: 1.6.2
255
213
  signing_key:
256
214
  specification_version: 3
257
215
  summary: Library for stubbing HTTP requests in Ruby.
@@ -261,6 +219,7 @@ test_files:
261
219
  - spec/em_http_request_spec.rb
262
220
  - spec/em_http_request_spec_helper.rb
263
221
  - spec/errors_spec.rb
222
+ - spec/example_curl_output.txt
264
223
  - spec/httpclient_spec.rb
265
224
  - spec/httpclient_spec_helper.rb
266
225
  - spec/net_http_spec.rb
@@ -285,6 +244,10 @@ test_files:
285
244
  - spec/vendor/addressable/lib/addressable/uri.rb
286
245
  - spec/vendor/addressable/lib/uri.rb
287
246
  - spec/vendor/crack/lib/crack.rb
247
+ - spec/vendor/right_http_connection-1.2.4/History.txt
248
+ - spec/vendor/right_http_connection-1.2.4/Manifest.txt
249
+ - spec/vendor/right_http_connection-1.2.4/README.txt
250
+ - spec/vendor/right_http_connection-1.2.4/Rakefile
288
251
  - spec/vendor/right_http_connection-1.2.4/lib/net_fix.rb
289
252
  - spec/vendor/right_http_connection-1.2.4/lib/right_http_connection.rb
290
253
  - spec/vendor/right_http_connection-1.2.4/setup.rb