fakeweb 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG +11 -0
  3. data/Rakefile +7 -7
  4. data/fakeweb.gemspec +41 -7
  5. data/lib/fake_web.rb +4 -1
  6. data/lib/fake_web/VERSION +1 -0
  7. data/lib/fake_web/ext/net_http.rb +18 -8
  8. data/lib/fake_web/registry.rb +8 -21
  9. data/lib/fake_web/utility.rb +28 -17
  10. data/test/test_fake_web.rb +1 -1
  11. data/test/test_other_net_http_libraries.rb +37 -0
  12. data/test/test_regexes.rb +17 -12
  13. data/test/test_utility.rb +0 -21
  14. data/test/vendor/right_http_connection-1.2.4/History.txt +59 -0
  15. data/test/vendor/right_http_connection-1.2.4/Manifest.txt +7 -0
  16. data/test/vendor/right_http_connection-1.2.4/README.txt +54 -0
  17. data/test/vendor/right_http_connection-1.2.4/Rakefile +103 -0
  18. data/test/vendor/right_http_connection-1.2.4/lib/net_fix.rb +160 -0
  19. data/test/vendor/right_http_connection-1.2.4/lib/right_http_connection.rb +435 -0
  20. data/test/vendor/right_http_connection-1.2.4/setup.rb +1585 -0
  21. data/test/vendor/samuel-0.2.1/.document +5 -0
  22. data/test/vendor/samuel-0.2.1/.gitignore +5 -0
  23. data/test/vendor/samuel-0.2.1/LICENSE +20 -0
  24. data/test/vendor/samuel-0.2.1/README.rdoc +70 -0
  25. data/test/vendor/samuel-0.2.1/Rakefile +62 -0
  26. data/test/vendor/samuel-0.2.1/VERSION +1 -0
  27. data/test/vendor/samuel-0.2.1/lib/samuel.rb +52 -0
  28. data/test/vendor/samuel-0.2.1/lib/samuel/net_http.rb +10 -0
  29. data/test/vendor/samuel-0.2.1/lib/samuel/request.rb +96 -0
  30. data/test/vendor/samuel-0.2.1/samuel.gemspec +69 -0
  31. data/test/vendor/samuel-0.2.1/test/request_test.rb +193 -0
  32. data/test/vendor/samuel-0.2.1/test/samuel_test.rb +42 -0
  33. data/test/vendor/samuel-0.2.1/test/test_helper.rb +66 -0
  34. data/test/vendor/samuel-0.2.1/test/thread_test.rb +32 -0
  35. metadata +36 -3
  36. data/VERSION +0 -1
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /doc
2
2
  /rdoc
3
+ /html
3
4
  /coverage
4
5
  /pkg
5
6
  /.idea
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ fakeweb (1.2.7)
2
+
3
+ * revert to sorting query params before matching requests against regexps,
4
+ instead of the 1.2.6 behavior that tried every possible order combination;
5
+ that was factorial-time, which made matching hang for requests with long query
6
+ strings [Jason Wadsworth, David Dollar, Blaine Cook]
7
+
8
+ * print a warning when FakeWeb is loaded before RightHttpConnection or after
9
+ Samuel, other libs that patch Net::HTTP [Chris Kampmeier, Ben Brinckerhoff]
10
+
11
+
1
12
  fakeweb (1.2.6)
2
13
 
3
14
  * fix that query params in a regex would have to be sorted for it to ever match
data/Rakefile CHANGED
@@ -3,11 +3,14 @@ puts "Using ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
3
3
  require 'rubygems'
4
4
  require 'rake'
5
5
 
6
+ version = File.read(File.join(File.dirname(__FILE__), "lib", "fake_web", "VERSION")).strip
7
+
6
8
  begin
7
9
  require 'jeweler'
8
10
  Jeweler::Tasks.new do |gem|
9
11
  gem.name = "fakeweb"
10
12
  gem.rubyforge_project = "fakeweb"
13
+ gem.version = version
11
14
  gem.summary = "A tool for faking responses to HTTP requests"
12
15
  gem.description = "FakeWeb is a helper for faking web requests in Ruby. It works at a global level, without modifying code or writing extensive stubs."
13
16
  gem.email = ["chris@kampers.net", "romeda@gmail.com"]
@@ -27,28 +30,26 @@ end
27
30
 
28
31
  require 'rake/testtask'
29
32
  Rake::TestTask.new(:test) do |test|
30
- test.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb")
33
+ test.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb", "test/vendor")
31
34
  test.verbose = false
32
35
  test.warning = true
33
36
  end
34
37
 
35
- task :default => :test
38
+ task :default => [:check_dependencies, :test]
36
39
 
37
40
 
38
41
  begin
39
42
  require 'rcov/rcovtask'
40
43
  Rcov::RcovTask.new do |t|
41
- t.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb")
44
+ t.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb", "test/vendor")
42
45
  t.rcov_opts << "--sort coverage"
43
46
  t.rcov_opts << "--exclude gems"
44
47
  t.warning = true
45
48
  end
46
- rescue
49
+ rescue LoadError
47
50
  print "rcov support disabled "
48
51
  if RUBY_PLATFORM =~ /java/
49
52
  puts "(running under JRuby)"
50
- elsif RUBY_VERSION =~ /^1\.9/
51
- puts "(running under Ruby 1.9)"
52
53
  else
53
54
  puts "(install RCov to enable the `rcov` task)"
54
55
  end
@@ -58,7 +59,6 @@ end
58
59
  begin
59
60
  require 'rdoc/task'
60
61
  Rake::RDocTask.new do |rdoc|
61
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
62
62
  rdoc.main = "README.rdoc"
63
63
  rdoc.rdoc_files.include("README.rdoc", "CHANGELOG", "LICENSE.txt", "lib/*.rb")
64
64
  rdoc.title = "FakeWeb #{version} API Documentation"
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fakeweb}
8
- s.version = "1.2.6"
8
+ s.version = "1.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Kampmeier", "Blaine Cook"]
12
- s.date = %q{2009-08-31}
12
+ s.date = %q{2009-11-02}
13
13
  s.description = %q{FakeWeb is a helper for faking web requests in Ruby. It works at a global level, without modifying code or writing extensive stubs.}
14
14
  s.email = ["chris@kampers.net", "romeda@gmail.com"]
15
15
  s.extra_rdoc_files = [
@@ -22,9 +22,9 @@ Gem::Specification.new do |s|
22
22
  "LICENSE.txt",
23
23
  "README.rdoc",
24
24
  "Rakefile",
25
- "VERSION",
26
25
  "fakeweb.gemspec",
27
26
  "lib/fake_web.rb",
27
+ "lib/fake_web/VERSION",
28
28
  "lib/fake_web/ext/net_http.rb",
29
29
  "lib/fake_web/registry.rb",
30
30
  "lib/fake_web/responder.rb",
@@ -44,12 +44,34 @@ Gem::Specification.new do |s|
44
44
  "test/test_fake_web_open_uri.rb",
45
45
  "test/test_helper.rb",
46
46
  "test/test_missing_open_uri.rb",
47
+ "test/test_other_net_http_libraries.rb",
47
48
  "test/test_precedence.rb",
48
49
  "test/test_query_string.rb",
49
50
  "test/test_regexes.rb",
50
51
  "test/test_response_headers.rb",
51
52
  "test/test_trailing_slashes.rb",
52
- "test/test_utility.rb"
53
+ "test/test_utility.rb",
54
+ "test/vendor/right_http_connection-1.2.4/History.txt",
55
+ "test/vendor/right_http_connection-1.2.4/Manifest.txt",
56
+ "test/vendor/right_http_connection-1.2.4/README.txt",
57
+ "test/vendor/right_http_connection-1.2.4/Rakefile",
58
+ "test/vendor/right_http_connection-1.2.4/lib/net_fix.rb",
59
+ "test/vendor/right_http_connection-1.2.4/lib/right_http_connection.rb",
60
+ "test/vendor/right_http_connection-1.2.4/setup.rb",
61
+ "test/vendor/samuel-0.2.1/.document",
62
+ "test/vendor/samuel-0.2.1/.gitignore",
63
+ "test/vendor/samuel-0.2.1/LICENSE",
64
+ "test/vendor/samuel-0.2.1/README.rdoc",
65
+ "test/vendor/samuel-0.2.1/Rakefile",
66
+ "test/vendor/samuel-0.2.1/VERSION",
67
+ "test/vendor/samuel-0.2.1/lib/samuel.rb",
68
+ "test/vendor/samuel-0.2.1/lib/samuel/net_http.rb",
69
+ "test/vendor/samuel-0.2.1/lib/samuel/request.rb",
70
+ "test/vendor/samuel-0.2.1/samuel.gemspec",
71
+ "test/vendor/samuel-0.2.1/test/request_test.rb",
72
+ "test/vendor/samuel-0.2.1/test/samuel_test.rb",
73
+ "test/vendor/samuel-0.2.1/test/test_helper.rb",
74
+ "test/vendor/samuel-0.2.1/test/thread_test.rb"
53
75
  ]
54
76
  s.homepage = %q{http://github.com/chrisk/fakeweb}
55
77
  s.rdoc_options = ["--charset=UTF-8"]
@@ -65,12 +87,23 @@ Gem::Specification.new do |s|
65
87
  "test/test_fake_web_open_uri.rb",
66
88
  "test/test_helper.rb",
67
89
  "test/test_missing_open_uri.rb",
90
+ "test/test_other_net_http_libraries.rb",
68
91
  "test/test_precedence.rb",
69
92
  "test/test_query_string.rb",
70
93
  "test/test_regexes.rb",
71
94
  "test/test_response_headers.rb",
72
95
  "test/test_trailing_slashes.rb",
73
- "test/test_utility.rb"
96
+ "test/test_utility.rb",
97
+ "test/vendor/right_http_connection-1.2.4/lib/net_fix.rb",
98
+ "test/vendor/right_http_connection-1.2.4/lib/right_http_connection.rb",
99
+ "test/vendor/right_http_connection-1.2.4/setup.rb",
100
+ "test/vendor/samuel-0.2.1/lib/samuel/net_http.rb",
101
+ "test/vendor/samuel-0.2.1/lib/samuel/request.rb",
102
+ "test/vendor/samuel-0.2.1/lib/samuel.rb",
103
+ "test/vendor/samuel-0.2.1/test/request_test.rb",
104
+ "test/vendor/samuel-0.2.1/test/samuel_test.rb",
105
+ "test/vendor/samuel-0.2.1/test/test_helper.rb",
106
+ "test/vendor/samuel-0.2.1/test/thread_test.rb"
74
107
  ]
75
108
 
76
109
  if s.respond_to? :specification_version then
@@ -86,3 +119,4 @@ Gem::Specification.new do |s|
86
119
  s.add_dependency(%q<mocha>, [">= 0.9.5"])
87
120
  end
88
121
  end
122
+
@@ -7,10 +7,13 @@ require 'fake_web/responder'
7
7
  require 'fake_web/stub_socket'
8
8
  require 'fake_web/utility'
9
9
 
10
+ FakeWeb::Utility.record_loaded_net_http_replacement_libs
11
+ FakeWeb::Utility.puts_warning_for_net_http_around_advice_libs_if_needed
12
+
10
13
  module FakeWeb
11
14
 
12
15
  # Returns the version string for the copy of FakeWeb you have loaded.
13
- VERSION = File.read(File.join(File.dirname(__FILE__), "..", "VERSION")).strip
16
+ VERSION = File.read(File.join(File.dirname(__FILE__), "fake_web", "VERSION")).strip
14
17
 
15
18
  # Resets the FakeWeb Registry. This will force all subsequent web requests to
16
19
  # behave as real requests.
@@ -0,0 +1 @@
1
+ 1.2.7
@@ -5,8 +5,7 @@ require 'stringio'
5
5
  module Net #:nodoc: all
6
6
 
7
7
  class BufferedIO
8
- alias initialize_without_fakeweb initialize
9
- def initialize(io, debug_output = nil)
8
+ def initialize_with_fakeweb(io, debug_output = nil)
10
9
  @read_timeout = 60
11
10
  @rbuf = ''
12
11
  @debug_output = debug_output
@@ -23,18 +22,20 @@ module Net #:nodoc: all
23
22
  end
24
23
  raise "Unable to create local socket" unless @io
25
24
  end
25
+ alias_method :initialize_without_fakeweb, :initialize
26
+ alias_method :initialize, :initialize_with_fakeweb
26
27
  end
27
28
 
28
29
  class HTTP
29
30
  class << self
30
- alias socket_type_without_fakeweb socket_type
31
- def socket_type
31
+ def socket_type_with_fakeweb
32
32
  FakeWeb::StubSocket
33
33
  end
34
+ alias_method :socket_type_without_fakeweb, :socket_type
35
+ alias_method :socket_type, :socket_type_with_fakeweb
34
36
  end
35
37
 
36
- alias request_without_fakeweb request
37
- def request(request, body = nil, &block)
38
+ def request_with_fakeweb(request, body = nil, &block)
38
39
  protocol = use_ssl? ? "https" : "http"
39
40
 
40
41
  path = request.path
@@ -62,10 +63,19 @@ module Net #:nodoc: all
62
63
  "Real HTTP connections are disabled. Unregistered request: #{request.method} #{uri}"
63
64
  end
64
65
  end
66
+ alias_method :request_without_fakeweb, :request
67
+ alias_method :request, :request_with_fakeweb
65
68
 
66
- alias connect_without_fakeweb connect
67
- def connect
69
+
70
+ def connect_with_fakeweb
71
+ unless @@alredy_checked_for_net_http_replacement_libs ||= false
72
+ FakeWeb::Utility.puts_warning_for_net_http_replacement_libs_if_needed
73
+ @@alredy_checked_for_net_http_replacement_libs = true
74
+ end
75
+ nil
68
76
  end
77
+ alias_method :connect_without_fakeweb, :connect
78
+ alias_method :connect, :connect_with_fakeweb
69
79
  end
70
80
 
71
81
  end
@@ -74,32 +74,19 @@ module FakeWeb
74
74
 
75
75
 
76
76
  def variations_of_uri_as_strings(uri_object)
77
- uris = []
78
- normalized_uri = normalize_uri(uri_object)
77
+ normalized_uri = normalize_uri(uri_object.dup)
78
+ normalized_uri_string = normalized_uri.to_s
79
79
 
80
- # all orderings of query parameters
81
- query = normalized_uri.query
82
- if query.nil? || query.empty?
83
- uris << normalized_uri
84
- else
85
- FakeWeb::Utility.simple_array_permutation(query.split('&')) do |p|
86
- current_permutation = normalized_uri.dup
87
- current_permutation.query = p.join('&')
88
- uris << current_permutation
89
- end
90
- end
91
-
92
- uri_strings = uris.map { |uri| uri.to_s }
80
+ variations = [normalized_uri_string]
93
81
 
94
- # including and omitting the default port
82
+ # if the port is implied in the original, add a copy with an explicit port
95
83
  if normalized_uri.default_port == normalized_uri.port
96
- uri_strings += uris.map { |uri|
97
- uri.to_s.sub(/#{Regexp.escape(normalized_uri.request_uri)}$/,
98
- ":#{normalized_uri.port}#{normalized_uri.request_uri}")
99
- }
84
+ variations << normalized_uri_string.sub(
85
+ /#{Regexp.escape(normalized_uri.request_uri)}$/,
86
+ ":#{normalized_uri.port}#{normalized_uri.request_uri}")
100
87
  end
101
88
 
102
- uri_strings
89
+ variations
103
90
  end
104
91
 
105
92
  def normalize_uri(uri)
@@ -18,26 +18,37 @@ module FakeWeb
18
18
  end
19
19
  end
20
20
 
21
- # Array#permutation wrapper for 1.8.6-compatibility. It only supports the
22
- # simple case that returns all permutations (so it doesn't take a numeric
23
- # argument).
24
- def self.simple_array_permutation(array, &block)
25
- # use native implementation if it exists
26
- return array.permutation(&block) if array.respond_to?(:permutation)
27
-
28
- yield array if array.length <= 1
21
+ def self.puts_warning_for_net_http_around_advice_libs_if_needed
22
+ libs = {"Samuel" => defined?(Samuel)}
23
+ warnings = libs.select { |_, loaded| loaded }.map do |name, _|
24
+ <<-TEXT.gsub(/ {10}/, '')
25
+ \e[1mWarning: FakeWeb was loaded after #{name}\e[0m
26
+ * #{name}'s code is being ignored when a request is handled by FakeWeb,
27
+ because both libraries work by patching Net::HTTP.
28
+ * To fix this, just reorder your requires so that FakeWeb is before #{name}.
29
+ TEXT
30
+ end
31
+ $stderr.puts "\n" + warnings.join("\n") + "\n" if warnings.any?
32
+ end
29
33
 
30
- array.length.times do |i|
31
- rest = array.dup
32
- picked = rest.delete_at(i)
33
- next if rest.empty?
34
+ def self.record_loaded_net_http_replacement_libs
35
+ libs = {"RightHttpConnection" => defined?(RightHttpConnection)}
36
+ @loaded_net_http_replacement_libs = libs.map { |name, loaded| name if loaded }.compact
37
+ end
34
38
 
35
- simple_array_permutation(rest) do |part_of_rest|
36
- yield [picked] + part_of_rest
37
- end
39
+ def self.puts_warning_for_net_http_replacement_libs_if_needed
40
+ libs = {"RightHttpConnection" => defined?(RightHttpConnection)}
41
+ warnings = libs.select { |_, loaded| loaded }.
42
+ reject { |name, _| @loaded_net_http_replacement_libs.include?(name) }.
43
+ map do |name, _|
44
+ <<-TEXT.gsub(/ {10}/, '')
45
+ \e[1mWarning: #{name} was loaded after FakeWeb\e[0m
46
+ * FakeWeb's code is being ignored, because #{name} replaces parts of
47
+ Net::HTTP without deferring to other libraries. This will break Net::HTTP requests.
48
+ * To fix this, just reorder your requires so that #{name} is before FakeWeb.
49
+ TEXT
38
50
  end
39
-
40
- array
51
+ $stderr.puts "\n" + warnings.join("\n") + "\n" if warnings.any?
41
52
  end
42
53
 
43
54
  end
@@ -533,7 +533,7 @@ class TestFakeWeb < Test::Unit::TestCase
533
533
  end
534
534
 
535
535
  def test_version
536
- assert_equal "1.2.6", FakeWeb::VERSION
536
+ assert_equal "1.2.7", FakeWeb::VERSION
537
537
  end
538
538
 
539
539
  end
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper")
2
+
3
+ class TestOtherNetHttpLibraries < Test::Unit::TestCase
4
+
5
+ def capture_output_from_requiring(libs, additional_code = "")
6
+ requires = libs.map { |lib| "require '#{lib}'" }.join("; ")
7
+ fakeweb_dir = "#{File.dirname(__FILE__)}/../lib"
8
+ vendor_dirs = Dir["#{File.dirname(__FILE__)}/vendor/*/lib"]
9
+ load_path_opts = vendor_dirs.unshift(fakeweb_dir).map { |dir| "-I#{dir}" }.join(" ")
10
+
11
+ # TODO: use the same Ruby executable that this test was invoked with
12
+ `ruby #{load_path_opts} -e "#{requires}; #{additional_code}" 2>&1`
13
+ end
14
+
15
+ def test_requiring_samuel_before_fakeweb_prints_warning
16
+ output = capture_output_from_requiring %w(samuel fakeweb)
17
+ assert_match %r(Warning: FakeWeb was loaded after Samuel), output
18
+ end
19
+
20
+ def test_requiring_samuel_after_fakeweb_does_not_print_warning
21
+ output = capture_output_from_requiring %w(fakeweb samuel)
22
+ assert output.empty?
23
+ end
24
+
25
+ def test_requiring_right_http_connection_before_fakeweb_and_then_connecting_does_not_print_warning
26
+ additional_code = "Net::HTTP.start('example.com')"
27
+ output = capture_output_from_requiring %w(right_http_connection fakeweb), additional_code
28
+ assert output.empty?
29
+ end
30
+
31
+ def test_requiring_right_http_connection_after_fakeweb_and_then_connecting_prints_warning
32
+ additional_code = "Net::HTTP.start('example.com')"
33
+ output = capture_output_from_requiring %w(fakeweb right_http_connection), additional_code
34
+ assert_match %r(Warning: RightHttpConnection was loaded after FakeWeb), output
35
+ end
36
+
37
+ end
@@ -44,17 +44,6 @@ class TestRegexes < Test::Unit::TestCase
44
44
  end
45
45
  end
46
46
 
47
- def test_requesting_a_uri_that_matches_two_registered_regexes_with_differently_ordered_query_params_raises_an_error
48
- FakeWeb.register_uri(:get, %r[example.com/list\?b=2&a=1], :body => "first")
49
- FakeWeb.register_uri(:get, %r[example.com/list\?a=1&b=2], :body => "second")
50
- assert_raise FakeWeb::MultipleMatchingURIsError do
51
- Net::HTTP.start("example.com") { |query| query.get('/list?a=1&b=2') }
52
- end
53
- assert_raise FakeWeb::MultipleMatchingURIsError do
54
- Net::HTTP.start("example.com") { |query| query.get('/list?b=2&a=1') }
55
- end
56
- end
57
-
58
47
  def test_requesting_a_uri_that_matches_two_registered_regexes_raises_an_error_including_request_info
59
48
  FakeWeb.register_uri(:get, %r|http://example\.com/|, :body => "first")
60
49
  FakeWeb.register_uri(:get, %r|http://example\.com/a|, :body => "second")
@@ -142,11 +131,27 @@ class TestRegexes < Test::Unit::TestCase
142
131
  assert !FakeWeb.registered_uri?(:get, "http://example.com/list?notimportant=1&unimportant=1")
143
132
  end
144
133
 
145
- def test_registry_matches_with_unsorted_query_params
134
+ def test_registry_does_not_match_when_regex_has_unsorted_query_params
146
135
  FakeWeb.register_uri(:get, %r[example\.com/list\?b=2&a=1], :body => "example")
136
+ assert !FakeWeb.registered_uri?(:get, "http://example.com/list?b=2&a=1")
137
+ assert !FakeWeb.registered_uri?(:get, "http://example.com/list?a=1&b=2")
138
+ assert !FakeWeb.registered_uri?(:get, "https://example.com:443/list?b=2&a=1")
139
+ end
140
+
141
+ def test_registry_matches_when_regex_has_sorted_query_params
142
+ FakeWeb.register_uri(:get, %r[example\.com/list\?a=1&b=2], :body => "example")
147
143
  assert FakeWeb.registered_uri?(:get, "http://example.com/list?b=2&a=1")
148
144
  assert FakeWeb.registered_uri?(:get, "http://example.com/list?a=1&b=2")
149
145
  assert FakeWeb.registered_uri?(:get, "https://example.com:443/list?b=2&a=1")
150
146
  end
151
147
 
148
+ def test_registry_matches_quickly_with_lots_of_query_params
149
+ # regression test for code that tried to calculate the permutations of the
150
+ # query params, which hangs with a large number of params
151
+ FakeWeb.register_uri(:get, %r[example.com], :body => "example")
152
+ Timeout::timeout(1) do
153
+ FakeWeb.registered_uri?(:get, "http://example.com/?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8")
154
+ end
155
+ end
156
+
152
157
  end
@@ -67,25 +67,4 @@ class TestUtility < Test::Unit::TestCase
67
67
  assert_equal uri, FakeWeb::Utility.strip_default_port_from_uri(uri)
68
68
  end
69
69
 
70
- def test_simple_array_permutation_with_one_element
71
- array, permutations = [1], [[1]]
72
- FakeWeb::Utility.simple_array_permutation(array) do |permutation|
73
- permutations.delete(permutation)
74
- end
75
- assert permutations.empty?
76
- end
77
-
78
- def test_simple_array_permutation_with_three_elements
79
- array = [1, 2, 3]
80
- permutations = [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
81
- FakeWeb::Utility.simple_array_permutation(array) do |permutation|
82
- permutations.delete(permutation)
83
- end
84
- assert permutations.empty?
85
- end
86
-
87
- def test_simple_array_permutation_return_value
88
- array = [1, 2, 3]
89
- assert array, FakeWeb::Utility.simple_array_permutation(array) { }
90
- end
91
70
  end