chrisk-fakeweb 1.1.2.7 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
- fakeweb (development)
1
+ fakeweb (1.2.0)
2
+
3
+ * add lib/fakeweb.rb so you can require "fakeweb" as well [Chris Kampmeier]
2
4
 
3
5
  * fix compatibility with Ruby 1.9.1 [Chris Kampmeier]
4
6
 
@@ -6,25 +6,18 @@ level, without modifying code or writing extensive stubs.
6
6
 
7
7
  == Installation
8
8
 
9
- This fork of Blaine Cook's original code has lots of fixes, stability
10
- improvements, and a few new features. It also has new support for Ruby 1.9.1
11
- and JRuby. To get it, install the latest gem directly from GitHub (currently
12
- 1.1.2.7):
9
+ The latest release of FakeWeb is once again available from your friendly
10
+ RubyForge mirror. Just install the gem:
13
11
 
14
- sudo gem install chrisk-fakeweb --source http://gems.github.com
12
+ sudo gem install fakeweb
15
13
 
16
14
 
17
15
  == Help and discussion
18
16
 
19
- There's a brand new mailing list at http://groups.google.com/group/fakeweb-users.
17
+ RDocs for the current release are available at http://fakeweb.rubyforge.org.
20
18
 
21
-
22
- == Development Notes
23
-
24
- We're currently considering how the API should change to add support for
25
- request bodies (see Known Issues below). Your input would be really helpful:
26
- see http://groups.google.com/group/fakeweb-users/browse_thread/thread/44d190a6b12e4273
27
- for a discussion of some different options. Thanks!
19
+ There's a mailing list for questions and discussion at
20
+ http://groups.google.com/group/fakeweb-users.
28
21
 
29
22
 
30
23
  == Examples
@@ -32,7 +25,7 @@ for a discussion of some different options. Thanks!
32
25
  Start by requiring FakeWeb:
33
26
 
34
27
  require 'rubygems'
35
- require 'fake_web'
28
+ require 'fakeweb'
36
29
 
37
30
  === Registering basic string responses
38
31
 
@@ -119,6 +112,7 @@ This is handy when you want to make sure your tests are self-contained, or you
119
112
  want to catch the scenario when a URI is changed in implementation code
120
113
  without a corresponding test change.
121
114
 
115
+
122
116
  == More info
123
117
 
124
118
  FakeWeb lets you decouple your test environment from live services without
@@ -138,8 +132,11 @@ like OpenURI, as well as a ton of libraries for popular web services.
138
132
 
139
133
  * Request bodies are ignored, including PUT and POST parameters. If you need
140
134
  different responses for different request bodies, you need to request
141
- different URLs, and register different responses for each. (Query strings
142
- are fully supported, though.)
135
+ different URLs, and register different responses for each. (Query strings are
136
+ fully supported, though.) We're currently considering how the API should
137
+ change to add support for request bodies in 1.3.0. Your input would be really
138
+ helpful: see http://groups.google.com/group/fakeweb-users/browse_thread/thread/44d190a6b12e4273
139
+ for a discussion of some different options. Thanks!
143
140
 
144
141
 
145
142
  == Copyright
@@ -4,7 +4,7 @@ require 'fake_web/ext/net_http'
4
4
  require 'fake_web/registry'
5
5
  require 'fake_web/response'
6
6
  require 'fake_web/responder'
7
- require 'fake_web/socket_delegator'
7
+ require 'fake_web/stub_socket'
8
8
 
9
9
  module FakeWeb
10
10
 
@@ -22,7 +22,7 @@ module Net #:nodoc: all
22
22
 
23
23
  class HTTP
24
24
  def self.socket_type
25
- FakeWeb::SocketDelegator
25
+ FakeWeb::StubSocket
26
26
  end
27
27
 
28
28
  alias :original_net_http_request :request
@@ -0,0 +1,15 @@
1
+ module FakeWeb
2
+ class StubSocket #:nodoc:
3
+
4
+ def initialize(*args)
5
+ end
6
+
7
+ def closed?
8
+ @closed ||= true
9
+ end
10
+
11
+ def readuntil(*args)
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ # So you can require "fakeweb" instead of "fake_web"
2
+ require "fake_web"
@@ -75,6 +75,16 @@ class TestFakeWeb < Test::Unit::TestCase
75
75
  assert FakeWeb.registered_uri?('https://example.com:443/')
76
76
  end
77
77
 
78
+ def test_register_uri_with_no_port_for_https_and_check_with_443_on_http
79
+ FakeWeb.register_uri('https://example.com/', :string => 'foo')
80
+ assert !FakeWeb.registered_uri?('http://example.com:443/')
81
+ end
82
+
83
+ def test_register_uri_with_no_port_for_http_and_check_with_80_on_https
84
+ FakeWeb.register_uri('http://example.com/', :string => 'foo')
85
+ assert !FakeWeb.registered_uri?('https://example.com:80/')
86
+ end
87
+
78
88
  def test_register_uri_for_any_method_explicitly
79
89
  FakeWeb.register_uri(:any, "http://example.com/rpc_endpoint", :string => "OK")
80
90
  assert FakeWeb.registered_uri?(:get, "http://example.com/rpc_endpoint")
@@ -472,4 +482,8 @@ class TestFakeWeb < Test::Unit::TestCase
472
482
  end
473
483
  assert response.body.split(/\n/).size == 3, "response has #{response.body.split(/\n/).size} lines should have 3"
474
484
  end
485
+
486
+ def test_requiring_fakeweb_instead_of_fake_web
487
+ require "fakeweb"
488
+ end
475
489
  end
metadata CHANGED
@@ -1,20 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chrisk-fakeweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2.7
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blaine Cook
8
+ - Chris Kampmeier
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-02-19 00:00:00 -08:00
13
+ date: 2009-03-07 00:00:00 -08:00
13
14
  default_executable:
14
- dependencies: []
15
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: mocha
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.9.5
25
+ version:
16
26
  description:
17
- email:
27
+ email: chris@kampers.net
18
28
  executables: []
19
29
 
20
30
  extensions: []
@@ -36,7 +46,8 @@ files:
36
46
  - lib/fake_web/registry.rb
37
47
  - lib/fake_web/responder.rb
38
48
  - lib/fake_web/response.rb
39
- - lib/fake_web/socket_delegator.rb
49
+ - lib/fake_web/stub_socket.rb
50
+ - lib/fakeweb.rb
40
51
  - test
41
52
  - test/fixtures
42
53
  - test/fixtures/google_response_from_curl
@@ -55,6 +66,12 @@ post_install_message:
55
66
  rdoc_options:
56
67
  - --main
57
68
  - README.rdoc
69
+ - --title
70
+ - FakeWeb API Documentation
71
+ - --charset
72
+ - utf-8
73
+ - --line-numbers
74
+ - --inline-source
58
75
  require_paths:
59
76
  - lib
60
77
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -71,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
88
  version:
72
89
  requirements: []
73
90
 
74
- rubyforge_project:
91
+ rubyforge_project: fakeweb
75
92
  rubygems_version: 1.2.0
76
93
  signing_key:
77
94
  specification_version: 2
@@ -1,24 +0,0 @@
1
- module FakeWeb
2
- class SocketDelegator #:nodoc:
3
-
4
- def initialize(delegate=nil)
5
- @delegate = nil
6
- end
7
-
8
- def method_missing(method, *args, &block)
9
- if @delegate
10
- @delegate.send(method, *args, &block)
11
- else
12
- self.send("my_#{method}", *args, &block)
13
- end
14
- end
15
-
16
- def my_closed?
17
- @closed ||= true
18
- end
19
-
20
- def my_readuntil(*args)
21
- end
22
-
23
- end
24
- end