webmock 0.7.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_webmock.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require File.join(File.dirname(__FILE__), "test_helper")
2
2
 
3
- require 'ostruct'
4
-
3
+ require 'ostruct'
4
+
5
5
  class TestWebMock < Test::Unit::TestCase
6
-
6
+
7
7
  def http_request(method, uri, options = {})
8
8
  begin
9
9
  uri = URI.parse(uri)
@@ -25,36 +25,42 @@ class TestWebMock < Test::Unit::TestCase
25
25
  :status => response.code })
26
26
  end
27
27
 
28
-
28
+
29
29
  def setup
30
30
  super
31
- stub_http_request(:any, "http://www.google.com")
32
- stub_http_request(:any, "https://www.google.com")
31
+ stub_http_request(:any, "http://www.example.com")
32
+ stub_http_request(:any, "https://www.example.com")
33
33
  end
34
-
34
+
35
+ def test_error_on_non_stubbed_request
36
+ assert_fail("Real HTTP connections are disabled. Unregistered request: GET http://www.example.net/") do
37
+ http_request(:get, "http://www.example.net/")
38
+ end
39
+ end
40
+
35
41
  def test_verification_that_expected_request_occured
36
- http_request(:get, "http://www.google.com/")
37
- assert_requested(:get, "http://www.google.com", :times => 1)
38
- assert_requested(:get, "http://www.google.com")
42
+ http_request(:get, "http://www.example.com/")
43
+ assert_requested(:get, "http://www.example.com", :times => 1)
44
+ assert_requested(:get, "http://www.example.com")
39
45
  end
40
-
46
+
41
47
  def test_verification_that_expected_request_didnt_occur
42
- assert_fail("The request GET http://www.google.com/ was expected to execute 1 time but it executed 0 times") do
43
- assert_requested(:get, "http://www.google.com")
48
+ assert_fail("The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times") do
49
+ assert_requested(:get, "http://www.example.com")
44
50
  end
45
- end
51
+ end
46
52
 
47
53
  def test_verification_that_expected_request_occured_with_body_and_headers
48
- http_request(:get, "http://www.google.com/",
54
+ http_request(:get, "http://www.example.com/",
49
55
  :body => "abc", :headers => {'A' => 'a'})
50
- assert_requested(:get, "http://www.google.com",
56
+ assert_requested(:get, "http://www.example.com",
51
57
  :body => "abc", :headers => {'A' => 'a'})
52
58
  end
53
59
 
54
60
  def test_verification_that_non_expected_request_didnt_occur
55
- assert_fail("The request GET http://www.google.com/ was expected to execute 0 times but it executed 1 time") do
56
- http_request(:get, "http://www.google.com/")
57
- assert_not_requested(:get, "http://www.google.com")
61
+ assert_fail("The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time") do
62
+ http_request(:get, "http://www.example.com/")
63
+ assert_not_requested(:get, "http://www.example.com")
58
64
  end
59
65
  end
60
66
 
data/webmock.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{webmock}
8
- s.version = "0.7.3"
8
+ s.version = "0.8.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bartosz Blimke"]
12
- s.date = %q{2009-11-24}
12
+ s.date = %q{2009-12-11}
13
13
  s.description = %q{WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.}
14
14
  s.email = %q{bartosz.blimke@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -31,7 +31,9 @@ Gem::Specification.new do |s|
31
31
  "lib/webmock/adapters/test_unit.rb",
32
32
  "lib/webmock/config.rb",
33
33
  "lib/webmock/errors.rb",
34
+ "lib/webmock/http_lib_adapters/httpclient.rb",
34
35
  "lib/webmock/http_lib_adapters/net_http.rb",
36
+ "lib/webmock/request.rb",
35
37
  "lib/webmock/request_execution_verifier.rb",
36
38
  "lib/webmock/request_profile.rb",
37
39
  "lib/webmock/request_registry.rb",
@@ -44,7 +46,10 @@ Gem::Specification.new do |s|
44
46
  "lib/webmock/util/headers.rb",
45
47
  "lib/webmock/util/uri.rb",
46
48
  "lib/webmock/webmock.rb",
49
+ "spec/httpclient_spec.rb",
50
+ "spec/httpclient_spec_helper.rb",
47
51
  "spec/net_http_spec.rb",
52
+ "spec/net_http_spec_helper.rb",
48
53
  "spec/other_net_http_libs_spec.rb",
49
54
  "spec/request_execution_verifier_spec.rb",
50
55
  "spec/request_profile_spec.rb",
@@ -91,7 +96,10 @@ Gem::Specification.new do |s|
91
96
  s.rubygems_version = %q{1.3.5}
92
97
  s.summary = %q{Library for stubbing HTTP requests in Ruby.}
93
98
  s.test_files = [
94
- "spec/net_http_spec.rb",
99
+ "spec/httpclient_spec.rb",
100
+ "spec/httpclient_spec_helper.rb",
101
+ "spec/net_http_spec.rb",
102
+ "spec/net_http_spec_helper.rb",
95
103
  "spec/other_net_http_libs_spec.rb",
96
104
  "spec/request_execution_verifier_spec.rb",
97
105
  "spec/request_profile_spec.rb",
@@ -127,13 +135,16 @@ Gem::Specification.new do |s|
127
135
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
128
136
  s.add_runtime_dependency(%q<addressable>, [">= 2.1.1"])
129
137
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
138
+ s.add_development_dependency(%q<httpclient>, [">= 2.1.5.2"])
130
139
  else
131
140
  s.add_dependency(%q<addressable>, [">= 2.1.1"])
132
141
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
142
+ s.add_dependency(%q<httpclient>, [">= 2.1.5.2"])
133
143
  end
134
144
  else
135
145
  s.add_dependency(%q<addressable>, [">= 2.1.1"])
136
146
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
147
+ s.add_dependency(%q<httpclient>, [">= 2.1.5.2"])
137
148
  end
138
149
  end
139
150
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-24 00:00:00 +00:00
12
+ date: 2009-12-11 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,16 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.2.9
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: httpclient
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.1.5.2
44
+ version:
35
45
  description: WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.
36
46
  email: bartosz.blimke@gmail.com
37
47
  executables: []
@@ -56,7 +66,9 @@ files:
56
66
  - lib/webmock/adapters/test_unit.rb
57
67
  - lib/webmock/config.rb
58
68
  - lib/webmock/errors.rb
69
+ - lib/webmock/http_lib_adapters/httpclient.rb
59
70
  - lib/webmock/http_lib_adapters/net_http.rb
71
+ - lib/webmock/request.rb
60
72
  - lib/webmock/request_execution_verifier.rb
61
73
  - lib/webmock/request_profile.rb
62
74
  - lib/webmock/request_registry.rb
@@ -69,7 +81,10 @@ files:
69
81
  - lib/webmock/util/headers.rb
70
82
  - lib/webmock/util/uri.rb
71
83
  - lib/webmock/webmock.rb
84
+ - spec/httpclient_spec.rb
85
+ - spec/httpclient_spec_helper.rb
72
86
  - spec/net_http_spec.rb
87
+ - spec/net_http_spec_helper.rb
73
88
  - spec/other_net_http_libs_spec.rb
74
89
  - spec/request_execution_verifier_spec.rb
75
90
  - spec/request_profile_spec.rb
@@ -138,7 +153,10 @@ signing_key:
138
153
  specification_version: 3
139
154
  summary: Library for stubbing HTTP requests in Ruby.
140
155
  test_files:
156
+ - spec/httpclient_spec.rb
157
+ - spec/httpclient_spec_helper.rb
141
158
  - spec/net_http_spec.rb
159
+ - spec/net_http_spec_helper.rb
142
160
  - spec/other_net_http_libs_spec.rb
143
161
  - spec/request_execution_verifier_spec.rb
144
162
  - spec/request_profile_spec.rb