Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Artifice #29

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions 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
Expand Down
4 changes: 2 additions & 2 deletions lib/net/http/persistent.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/test_net_http_persistent.rb
Expand Up @@ -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/'
Expand Down