<commit_before>shared_examples_for "Net::HTTP" do
  describe "when making real requests", :net_connect => true do
    let(:port){ WebMockServer.instance.port }

    before(:each) do
      @http = Net::HTTP.new("localhost", port)
    end

    it "should return a Net::ReadAdapter from response.body when a real request is made with a block and #read_body", :net_connect => true do
      response = Net::HTTP.new("localhost", port).request_get('/') { |r| r.read_body { } }
      response.body.should be_a(Net::ReadAdapter)
    end

    if RUBY_VERSION < '1.9' #looks like StringIO doesn't respons to bytesize in ruby 1.9 - weird
      it "should handle real requests with readable body", :net_connect => true do
        req = Net::HTTP::Post.new("/")
        Net::HTTP.start("localhost", port) {|http|
          http.request(req, StringIO.new("my_params"))
        }.body.should =~ /hello world/
      end
    end

    it "should handle requests with block passed to read_body", :net_connect => true do
      body = ""
      req = Net::HTTP::Get.new("/")
      Net::HTTP.start("localhost", port) do |http|
        http.request(req) do |res|
          res.read_body do |str|
            body << str
          end
        end
      end
      body.should =~ /hello world/<commit_msg>Removed real Net::HTTP spec which often didn't work and it probably shouldn't work anyway<commit_after>shared_examples_for "Net::HTTP" do
  describe "when making real requests", :net_connect => true do
    let(:port){ WebMockServer.instance.port }

    before(:each) do
      @http = Net::HTTP.new("localhost", port)
    end

    it "should return a Net::ReadAdapter from response.body when a real request is made with a block and #read_body", :net_connect => true do
      response = Net::HTTP.new("localhost", port).request_get('/') { |r| r.read_body { } }
      response.body.should be_a(Net::ReadAdapter)
    end

    it "should handle requests with block passed to read_body", :net_connect => true do
      body = ""
      req = Net::HTTP::Get.new("/")
      Net::HTTP.start("localhost", port) do |http|
        http.request(req) do |res|
          res.read_body do |str|
            body << str
          end
        end
      end
      body.should =~ /hello world/
{'fraction_non_alphanumeric': 0.12805691418408183, 'fraction_numerical': 0.0017785682525566918, 'mean_word_length': 2.7562604340567614, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4788239', 'n_tokens_mistral': 681, 'n_tokens_neox': 663, 'n_words': 211}