Skip to content

Loading…

Support for Artifice #29

Closed
wants to merge 1 commit into from

6 participants

@cc
cc commented

When testing with Artifice you get the same sorts of issues reusing the SSL sessions with FakeWeb and WebMock.

This adds Artifice to the list of test frameworks supported.

@travisbot

This pull request passes (merged 7e961ed into 9f86179).

@drbrain drbrain closed this in fae5b58
@drbrain
Owner

Please don't edit VERSION in the future, I had to apply by hand :/

@zzak

I think changelog should be left to maintainer as well

@cc
cc commented

Sure sorry folks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 2, 2012
  1. @cc

    When Artifice is loaded SSL sessions will not be reused to prevent br…

    cc committed
    …eakage
    
    when testing with this framework.
Showing with 18 additions and 2 deletions.
  1. +6 −0 History.txt
  2. +2 −2 lib/net/http/persistent.rb
  3. +10 −0 test/test_net_http_persistent.rb
View
6 History.txt
@@ -1,3 +1,9 @@
+=== 2.8.1 / 2012-07-12
+
+* Minor enhancement
+ * When Artifice is loaded SSL sessions will not be reused to prevent breakage
+ when testing with this framework.
+
=== 2.8 / 2012-06-11
* Minor enhancement
View
4 lib/net/http/persistent.rb
@@ -176,7 +176,7 @@ class Net::HTTP::Persistent
##
# The version of Net::HTTP::Persistent you are using
- VERSION = '2.8'
+ VERSION = '2.8.1'
##
# Error class for errors raised by Net::HTTP::Persistent. Various
@@ -620,7 +620,7 @@ def finish connection, thread = Thread.current
end
def http_class # :nodoc:
- if [:FakeWeb, :WebMock].any? { |klass| Object.const_defined?(klass) } or
+ if [:Artifice, :FakeWeb, :WebMock].any? { |klass| Object.const_defined?(klass) } or
not @reuse_ssl_sessions then
Net::HTTP
else
View
10 test/test_net_http_persistent.rb
@@ -373,6 +373,16 @@ def test_connection_for_http_class_with_webmock
end
end
+ def test_connection_for_http_class_with_artifice
+ Object.send :const_set, :Artifice, nil
+ c = @http.connection_for @uri
+ assert_instance_of Net::HTTP, c
+ ensure
+ if Object.const_defined?(:Artifice) then
+ Object.send :remove_const, :Artifice
+ end
+ end
+
def test_connection_for_name
http = Net::HTTP::Persistent.new 'name'
uri = URI.parse 'http://example/'
Something went wrong with that request. Please try again.