<commit_before>require 'minitest_helper'

if RUBY_VERSION >= '1.9.3'
  describe Oboe::Inst::RestClientRequest do
    before do
      clear_all_traces
      @collect_backtraces = Oboe::Config[:rest_client][:collect_backtraces]
    end

    after do
      Oboe::Config[:rest_client][:collect_backtraces] = @collect_backtraces
    end

    it 'RestClient should be defined and ready' do
      defined?(::RestClient).wont_match nil
    end

    it 'RestClient should have oboe methods defined' do
      [ :execute_with_oboe ].each do |m|
        ::RestClient::Request.method_defined?(m).must_equal true
      end
    end

    it "should trace a request to an instr'd app" do
      response = nil
<commit_msg>Validate rest-client KVs in __Init<commit_after>require 'minitest_helper'

if RUBY_VERSION >= '1.9.3'
  describe Oboe::Inst::RestClientRequest do
    before do
      clear_all_traces
      @collect_backtraces = Oboe::Config[:rest_client][:collect_backtraces]
    end

    after do
      Oboe::Config[:rest_client][:collect_backtraces] = @collect_backtraces
    end

    it 'RestClient should be defined and ready' do
      defined?(::RestClient).wont_match nil
    end

    it 'RestClient should have oboe methods defined' do
      [ :execute_with_oboe ].each do |m|
        ::RestClient::Request.method_defined?(m).must_equal true
      end
    end

    it "should report rest-client version in __Init" do
      init_kvs = ::Oboe::Util.build_init_report

      init_kvs.key?('Ruby.RestClient.Version').must_equal true
      init_kvs['Ruby.RestClient.Version'].must_equal "RestClient-#{::RestClient::VERSION}"
    end

    it "should trace a request to an instr'd app" do
      response = nil

{'fraction_non_alphanumeric': 0.0966411314083677, 'fraction_numerical': 0.0035356511490866236, 'mean_word_length': 3.421875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6527737', 'n_tokens_mistral': 559, 'n_tokens_neox': 546, 'n_words': 135}