jam-cloud/web/spec/support/remote_ip_monkey_patch.rb

36 lines
602 B
Ruby

module RequestWithMocking
def remote_ip
test_ip = ENV['RAILS_TEST_IP_ADDRESS']
unless test_ip.nil? or test_ip.empty?
return test_ip
else
return super
end
end
end
#module ActionDispatch
# class Request
#
# def remote_ip_with_mocking
# test_ip = ENV['RAILS_TEST_IP_ADDRESS']
#
# unless test_ip.nil? or test_ip.empty?
# return test_ip
# else
# return remote_ip_without_mocking
# end
# end
#
# alias_method_chain :remote_ip, :mocking
#
# end
#end
module ActionDispatch
class Request
prepend RequestWithMocking
end
end