chrisk-fakeweb 1.1.2.1 → 1.1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/README +1 -7
- data/Rakefile +1 -1
- data/fakeweb.gemspec +2 -2
- data/lib/fake_web.rb +8 -1
- data/test/test_fake_web.rb +7 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
fakeweb (development)
|
2
2
|
|
3
3
|
[ Chris Kampmeier ]
|
4
|
+
* sort query params before storing internally, so that
|
5
|
+
http://example.com/?a=1&b=2 and http://example.com/?b=2&a=1 are considered
|
6
|
+
the same URL (although this is technically incorrect, it's much more
|
7
|
+
convenient--most web apps work that way, and Net::HTTP's use of a hash to
|
8
|
+
pass query params means that the order in which FakeWeb stores them can be
|
9
|
+
unpredictable)
|
4
10
|
* add support for ports in URLs, so that http://example.com/ and
|
5
11
|
http://example.com:3000/ are not the same
|
6
12
|
* fix for non-faked SSL requests failing with "Unable to create local socket"
|
data/README
CHANGED
@@ -29,15 +29,9 @@ soap4r[http://dev.ctor.org/soap4r/], etc.)
|
|
29
29
|
|
30
30
|
= Known Issues
|
31
31
|
|
32
|
-
* Request bodies are ignored, including
|
32
|
+
* Request bodies are ignored, including PUT and POST parameters. If you
|
33
33
|
need different responses for different request bodies, you need to request
|
34
34
|
different URLs, and register different responses for each.
|
35
|
-
* Query-string parameter order is significant, so GET http://example.com/?a=1&b=1
|
36
|
-
and GET http://example.com/?b=1&a=1 are considered different requests. This is
|
37
|
-
technically correct, but it's often a nuisance in practice since 1) many servers
|
38
|
-
return the same resource for any ordering of the key=value pairs, and
|
39
|
-
2) Net::HTTP's use of a hash to specify query parameters means that the order
|
40
|
-
is unpredictable.
|
41
35
|
|
42
36
|
= Copyright
|
43
37
|
|
data/Rakefile
CHANGED
@@ -25,7 +25,7 @@ spec = Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency('rake')
|
26
26
|
s.add_dependency('rcov')
|
27
27
|
s.name = "FakeWeb"
|
28
|
-
s.version = "1.1.2.
|
28
|
+
s.version = "1.1.2.2"
|
29
29
|
s.author = "Blaine Cook"
|
30
30
|
s.email = "romeda@gmail.com"
|
31
31
|
s.homepage = "http://fakeweb.rubyforge.org/"
|
data/fakeweb.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "fakeweb"
|
3
|
-
s.version = "1.1.2.
|
4
|
-
s.date = "2008-10-
|
3
|
+
s.version = "1.1.2.2"
|
4
|
+
s.date = "2008-10-22"
|
5
5
|
s.summary = "A test helper that makes it simple to test HTTP interaction"
|
6
6
|
s.homepage = "http://github.com/chrisk/fakeweb"
|
7
7
|
s.has_rdoc = true
|
data/lib/fake_web.rb
CHANGED
@@ -120,9 +120,16 @@ module FakeWeb
|
|
120
120
|
when URI: uri
|
121
121
|
else
|
122
122
|
uri = 'http://' + uri unless uri.match('^https?://')
|
123
|
-
URI.parse(uri)
|
123
|
+
parsed_uri = URI.parse(uri)
|
124
|
+
parsed_uri.query = sort_query_params(parsed_uri.query)
|
125
|
+
parsed_uri
|
124
126
|
end
|
125
127
|
end
|
128
|
+
|
129
|
+
def sort_query_params(query)
|
130
|
+
return nil if query.nil?
|
131
|
+
query.split('&').sort.join('&')
|
132
|
+
end
|
126
133
|
end
|
127
134
|
|
128
135
|
module Response #:nodoc:
|
data/test/test_fake_web.rb
CHANGED
@@ -319,4 +319,11 @@ class TestFakeWeb < Test::Unit::TestCase
|
|
319
319
|
assert_equal 'Not Found', exception.response.msg
|
320
320
|
end
|
321
321
|
|
322
|
+
def test_registry_sort_query_params
|
323
|
+
assert_equal "a=1&b=2", FakeWeb::Registry.instance.send(:sort_query_params, "b=2&a=1")
|
324
|
+
end
|
325
|
+
|
326
|
+
def test_registry_sort_query_params_sorts_by_value_if_keys_collide
|
327
|
+
assert_equal "a=1&a=2&b=2", FakeWeb::Registry.instance.send(:sort_query_params, "a=2&b=2&a=1")
|
328
|
+
end
|
322
329
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chrisk-fakeweb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.2.
|
4
|
+
version: 1.1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blaine Cook
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|