<commit_before>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

WebMock.allow_net_connect!

describe 'External calls to mixpanel' do
  before :all do
    config = YAML.load_file(File.join(
                              File.dirname(__FILE__),
                              '..',
                              '..',
                              'config',
                              'mixpanel.yml'
    ))['mixpanel']

    expect(config).not_to be_nil
    @client = Mixpanel::Client.new(config)
  end

  context 'when requesting event properties' do
    it 'should raise an error for bad requests' do
      data = lambda do
        @client.request('properties', {})
      end
      expect(data).to raise_error(Mixpanel::HTTPError)
    end

    it 'should return events' do
      data = @client.request('events/properties',
                             event: '["test-event"]',
                             name: 'hello',
                             values: '["uno", "dos"]',
                             type: 'general',
                             unit: 'hour',
                             interval: 24,
                             limit: 5,
                             bucket: 'kicked')
      expect(data().not_to be_a Exception
    end
  end
end<commit_msg>Fixed typo.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

WebMock.allow_net_connect!

describe 'External calls to mixpanel' do
  before :all do
    config = YAML.load_file(File.join(
                              File.dirname(__FILE__),
                              '..',
                              '..',
                              'config',
                              'mixpanel.yml'
    ))['mixpanel']

    expect(config).not_to be_nil
    @client = Mixpanel::Client.new(config)
  end

  context 'when requesting event properties' do
    it 'should raise an error for bad requests' do
      data = lambda do
        @client.request('properties', {})
      end
      expect(data).to raise_error(Mixpanel::HTTPError)
    end

    it 'should return events' do
      data = @client.request('events/properties',
                             event: '["test-event"]',
                             name: 'hello',
                             values: '["uno", "dos"]',
                             type: 'general',
                             unit: 'hour',
                             interval: 24,
                             limit: 5,
                             bucket: 'kicked')
      expect(data).not_to be_a Exception
    end
  end
end
{'fraction_non_alphanumeric': 0.10657331777518475, 'fraction_numerical': 0.002333722287047841, 'mean_word_length': 1.2423714036617262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4035184', 'n_tokens_mistral': 667, 'n_tokens_neox': 650, 'n_words': 154}