Sha256: 568d12f9f9abb1bd9f47b750f0c9efbc94a8daf47c10bc562b1b7de6262607fd
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require File.expand_path("#{File.dirname(__FILE__)}/../helper") require "net/http" class RorVsWild::Plugin::NetHttpTest < Minitest::Test def test_callback client.measure_block("test") { Net::HTTP.get("ruby-lang.org", "/index.html") } assert_equal(1, client.send(:queries).size) assert_equal(1, client.send(:queries)[0][:times]) assert_equal("http", client.send(:queries)[0][:kind]) assert_match("GET http://ruby-lang.org/index.html", client.send(:queries)[0][:command]) end def test_callback_with_https client.measure_block("test") { Net::HTTP.get(URI("https://www.ruby-lang.org/index.html")) } assert_match("GET https://www.ruby-lang.org/index.html", client.send(:queries)[0][:command]) assert_equal("http", client.send(:queries)[0][:kind]) end def test_nested_query_because_net_http_request_is_recursive_when_connection_is_not_started client.measure_block("test") do uri = URI("http://www.ruby-lang.org/index.html") http = Net::HTTP.new(uri.host, uri.port) http.request(Net::HTTP::Get.new(uri.path)) end assert_equal(1, client.send(:queries)[0][:times]) end private def client @client ||= initialize_client(app_root: "/rails/root") end def initialize_client(options = {}) client = RorVsWild::Client.new(options) client.stubs(:post_request) client.stubs(:post_job) client end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rorvswild-0.6.1 | test/plugin/net_http_test.rb |
rorvswild-0.6.0 | test/plugin/net_http_test.rb |