<commit_before>require 'helper'

describe BWAPI::Client do

  before do
    BWAPI.reset
  end

  describe 'when called' do
    it 'should be a client class instance' do
      BWAPI::Client.new.should be_an_instance_of BWAPI::Client
    end
  end

  describe 'configuration' do
    describe 'instance variables' do
      it 'should create a api_endpoint instance variable' do
        expect(BWAPI::Client.new.respond_to?(:api_endpoint)).to eq(true)
      end

      it 'should create a user_agent instance variable' do
        expect(BWAPI::Client.new.respond_to?(:user_agent)).to eq(true)
      end

      it 'should create a adapter instance variable' do
        expect(BWAPI::Client.new.respond_to?(:adapter)).to eq(true)
      end

      it 'should create a username instance variable' do
        expect(BWAPI::Client.new.respond_to?(:username)).to eq(true)
      end

      it 'should create a password instance variable' do
        expect(BWAPI::Client.new.respond_to?(:password)).to eq(true)
      end

      it 'should create a grant_type instance variable' do
        expect(BWAPI::Client.new.respond_to?(:grant_type)).to eq(true)
      end

      it 'should create a access_token instance variable' do
        expect(BWAPI::Client.new.respond_to?(:access_token)).to eq(true)
      end

      it 'should create a refresh_token instance variable' do
        expect(BWAPI::Client.new.respond_to?(:refresh_token)).to eq(true)
      end

      it 'should create a expires_in instance variable' do
        expect(BWAPI::Client.new.respond_to?(:expires_in)).to eq(true)
      end

      it 'should create a client_id instance variable' do
        expect(BWAPI::Client.new.respond_to?(:client_id)).to eq(true)
      end

      it 'should create a client_secret instance variable' do
        expect(BWAPI::Client.new.respond_to?(:client_secret)).to eq(true)
      end

      it 'should create a netrc instance variable' do
        expect(BWAPI::Client.new.respond_to?(:netrc)).to eq(true)
      end
    end

    describe 'default values' do
      it 'should have :net_http as the default adapter' do
        expect(BWAPI::Client.new.adapter).to eql(:net_http)
      end

      it 'should have a default user agent' do
        expect(BWAPI::Client.new.user_agent).to eql("BWAPI Ruby Gem #{BWAPI::VERSION}")
      end

      it 'should have a default api endpoint' do
        expect(BWAPI::Client.new.api_endpoint).to eql("http://newapi.brandwatch.com/")
      end

      it 'should have a default client id' do
        expect(BWAPI::Client.new.client_id).to eql("brandwatch-api-client")
      end

      it 'should have a default for netrc' do
        expect(BWAPI::Client.new.netrc).to eql(false)
      end

      it 'should have a default value of nil for username' do
        expect(BWAPI::Client.new.username).to eql(nil)
      end

      it 'should have a default value of nil for password' do
        expect(BWAPI::Client.new.password).to eql(nil)
      end

      it 'should have a default value of nil for grant_type' do
        expect(BWAPI::Client.new.grant_type).to eql(nil)
      end

      it 'should have a default value of nil for access_token' do
        expect(BWAPI::Client.new.access_token).to eql(nil)
      end

      it 'should have a default value of nil for refresh_token' do
        expect(BWAPI::Client.new.refresh_token).to eql(nil)
      end

      it 'should have a default value of nil for client_secret' do
        expect(BWAPI::Client.new.client_secret).to eql(nil)
      end
    end

  end
end<commit_msg>Added custom configuration tests to client_spec.rb<commit_after>require 'helper'

describe BWAPI::Client do

  before do
    BWAPI.reset
  end

  describe 'when called' do
    it 'should be a client class instance' do
      BWAPI::Client.new.should be_an_instance_of BWAPI::Client
    end
  end

  describe 'configuration' do
    describe 'instance variables' do
      it 'should create a api_endpoint instance variable' do
        expect(BWAPI::Client.new.respond_to?(:api_endpoint)).to eq(true)
      end

      it 'should create a user_agent instance variable' do
        expect(BWAPI::Client.new.respond_to?(:user_agent)).to eq(true)
      end

      it 'should create a adapter instance variable' do
        expect(BWAPI::Client.new.respond_to?(:adapter)).to eq(true)
      end

      it 'should create a username instance variable' do
        expect(BWAPI::Client.new.respond_to?(:username)).to eq(true)
      end

      it 'should create a password instance variable' do
        expect(BWAPI::Client.new.respond_to?(:password)).to eq(true)
      end

      it 'should create a grant_type instance variable' do
        expect(BWAPI::Client.new.respond_to?(:grant_type)).to eq(true)
      end

      it 'should create a access_token instance variable' do
        expect(BWAPI::Client.new.respond_to?(:access_token)).to eq(true)
      end

      it 'should create a refresh_token instance variable' do
        expect(BWAPI::Client.new.respond_to?(:refresh_token)).to eq(true)
      end

      it 'should create a expires_in instance variable' do
        expect(BWAPI::Client.new.respond_to?(:expires_in)).to eq(true)
      end

      it 'should create a client_id instance variable' do
        expect(BWAPI::Client.new.respond_to?(:client_id)).to eq(true)
      end

      it 'should create a client_secret instance variable' do
        expect(BWAPI::Client.new.respond_to?(:client_secret)).to eq(true)
      end

      it 'should create a netrc instance variable' do
        expect(BWAPI::Client.new.respond_to?(:netrc)).to eq(true)
      end
    end

    describe 'default configuration values' do
      it 'should have a default adapter' do
        expect(BWAPI::Client.new.adapter).to eql(:net_http)
      end

      it 'should have a default user agent' do
        expect(BWAPI::Client.new.user_agent).to eql("BWAPI Ruby Gem #{BWAPI::VERSION}")
      end

      it 'should have a default api endpoint' do
        expect(BWAPI::Client.new.api_endpoint).to eql("http://newapi.brandwatch.com/")
      end

      it 'should have a default client id' do
        expect(BWAPI::Client.new.client_id).to eql("brandwatch-api-client")
      end

      it 'should have a default for netrc' do
        expect(BWAPI::Client.new.netrc).to eql(false)
      end

      it 'should have a default value of nil for username' do
        expect(BWAPI::Client.new.username).to eql(nil)
      end

      it 'should have a default value of nil for password' do
        expect(BWAPI::Client.new.password).to eql(nil)
      end

      it 'should have a default value of nil for grant_type' do
        expect(BWAPI::Client.new.grant_type).to eql(nil)
      end

      it 'should have a default value of nil for access_token' do
        expect(BWAPI::Client.new.access_token).to eql(nil)
      end

      it 'should have a default value of nil for refresh_token' do
        expect(BWAPI::Client.new.refresh_token).to eql(nil)
      end

      it 'should have a default value of nil for client_secret' do
        expect(BWAPI::Client.new.client_secret).to eql(nil)
      end
    end

    describe 'custom configuration' do
      it 'should allow a user to set a default adapter' do
        bw = BWAPI::Client.new :adapter => 'custom_adapter'
        expect(bw.adapter).to eql('custom_adapter')
      end

      it 'should allow a user to set a user agent' do
        bw = BWAPI::Client.new :user_agent => 'custom_user_agent'
        expect(bw.user_agent).to eql('custom_user_agent')
      end

      it 'should allow a user to set a api endpoint' do
        bw = BWAPI::Client.new :api_endpoint => 'http://newapi.custom.brandwatch.com'
        expect(bw.api_endpoint).to eql('http://newapi.<EMAIL>')
      end

      it 'should allow a user to set a username' do
        bw = BWAPI::Client.new :username => '<EMAIL>'
        expect(bw.username).to eql('<EMAIL>')
      end

      it 'should allow a user to set a password' do
        bw = BWAPI::Client.new :password => '<PASSWORD>'
        expect(bw.password).to eql('<PASSWORD>')
      end

      it 'should allow a user to set a grant type' do
        bw = BWAPI::Client.new :grant_type => 'custom_grant_type'
        expect(bw.grant_type).to eql('custom_grant_type')
      end

      it 'should allow a user to set a access token' do
        bw = BWAPI::Client.new :access_token => 'abcdef-gh<PASSWORD>'
        expect(bw.access_token).to eql('abcdef-gh<PASSWORD>')
      end

      it 'should allow a user to set a refresh token' do
        bw = BWAPI::Client.new :refresh_token => 'abcdef-<PASSWORD>'
        expect(bw.refresh_token).to eql('abcdef-<PASSWORD>')
      end

      it 'should allow a user to set a client id' do
        bw = BWAPI::Client.new :client_id => 'custom_client_id'
        expect(bw.client_id).to eql('custom_client_id')
      end

      it 'should allow a user to set a client secret' do
        bw = BWAPI::Client.new :client_secret => 'custom_client_secret'
        expect(bw.client_secret).to eql('custom_client_secret')
      end

      it 'should allow a user to set the netrc flag' do
        bw = BWAPI::Client.new :netrc => true
        expect(bw.netrc).to eql(true)
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.10117365790045642, 'fraction_numerical': 0.0, 'mean_word_length': 2.74867617107943, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 23, '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': '2854094', 'n_tokens_mistral': 2908, 'n_tokens_neox': 2754, 'n_words': 836}