webmock
webmock copied to clipboard
Patron name clash with business entity
If an application has a table patrons and a model Patron, then it causes webmock not to work, because it checks if Patron is defined. Because Patron is defined, it fails with uninitialized constant Patron::Session
# lib/webmock/http_lib_adapters/patron_adapter.rb
begin
require 'patron'
rescue LoadError
# patron not found
end
if defined?(::Patron) # <<<--- replace this?
maybe replace with?
if defined?(::Patron) && defined?(::Patron::Session)
@pedrocarmona thanks for explaining the issue.
I believe if defined?(::Patron::Session) should be enough, there is no need to check for if defined?(::Patron) && defined?(::Patron::Session)