<commit_before>require 'spec_helper'

describe Vertebrae::Request do
  let(:vb) { Vertebrae::API.new  }
  let(:path) { 'actionkit.api/rest/v1/action' }
  let(:params) { {} }
  let(:options) { {} }

  it "knows how to make get request" do
    vb.should_receive(:request).with(:get, path, params, options)
    vb.get_request path, params, options
  end

  it "knows how to make patch request" do
    vb.should_receive(:request).with(:patch, path, params, options)
    vb.patch_request path, params, options
  end

  it "knows how to make post request" do
    vb.should_receive(:request).with(:post, path, params, options)
    vb.post_request path, params, options
  end

  it "knows how to make put request" do
    vb.should_receive(:request).with(:put, path, params, options)
    vb.put_request path, params, options
  end

  it "knows how to make delete request" do
    vb.should_receive(:request).with(:delete, path, params, options)
    vb.delete_request path, params, options
  end

  describe 'it should result in an appropriately configured connection object when it comes time to run transactions' do
    describe 'initialize' do
      before(:each) do
        Vertebrae::API.any_instance.stub(:default_options).and_return({host: 'test.com'})
      end

      context 'with an empty hash' do
        let(:options) { {} }
        it 'should make the request to the default host' do
          skip
          stub_request(:get, 'https://test.com/path')
          vb.request(:get, '/path', {}, content_type: 'text/csv')
        end
      end

      context 'with a different host' do
        let(:options) { {host: 'test2.com'} }
        it 'should make the request to the default host' do
          skip
          stub_request(:get, 'https://test2.com/path')
          vb.request(:get, '/path', {}, content_type: 'text/csv')
        end
      end
    end
  end
end<commit_msg>test request option behavior with webmock<commit_after>require 'spec_helper'

describe Vertebrae::Request do
  let(:vb) { Vertebrae::API.new  }
  let(:path) { 'actionkit.api/rest/v1/action' }
  let(:params) { {} }
  let(:options) { {} }

  it "knows how to make get request" do
    vb.should_receive(:request).with(:get, path, params, options)
    vb.get_request path, params, options
  end

  it "knows how to make patch request" do
    vb.should_receive(:request).with(:patch, path, params, options)
    vb.patch_request path, params, options
  end

  it "knows how to make post request" do
    vb.should_receive(:request).with(:post, path, params, options)
    vb.post_request path, params, options
  end

  it "knows how to make put request" do
    vb.should_receive(:request).with(:put, path, params, options)
    vb.put_request path, params, options
  end

  it "knows how to make delete request" do
    vb.should_receive(:request).with(:delete, path, params, options)
    vb.delete_request path, params, options
  end

  describe 'it should result in an appropriately configured connection object when it comes time to run transactions' do
      before(:each) do
        logger = double
        logger.stub(:debug).and_return(true)
        Vertebrae::Base.stub(:logger).and_return(logger)
        Vertebrae::API.any_instance.stub(:default_options).and_return({host: 'test.com'})
      end

      context 'with an empty hash' do
        let(:options) { {} }
        it 'should make the request to the default host' do
          stub_request(:get, 'https://test.com/path')
          vb.request(:get, '/path', {}, options)
        end
      end

      context 'with a different host' do
        let(:options) { {host: 'test2.com'} }
        it 'should make the request to the default host' do
          stub_request(:get, 'https://test2.com/path')
          vb.request(:get, '/path', {}, options)
        end
      end
    end
end
{'fraction_non_alphanumeric': 0.11880409126671912, 'fraction_numerical': 0.0015735641227380016, 'mean_word_length': 2.993717277486911, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '4970709', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1156, 'n_words': 358}