<commit_before>require 'spec_helper'
require 'vcr'

describe FullCircle::API do

  describe "#fetch_events_for_ad" do

    let!(:api){FullCircle::API.new(FullCircle::Connection.new("360durango.com"))}

    context "with one event" do
      it "returns an array of one event" do
        VCR.use_cassette "single_get_events_response" do
          results = api.fetch_events_for_ad "81213"
          results.should be_a Array
          results.first.should be_a FullCircle::Event
        end
      end

    end
    
    context "with multiple events" do
      it "returns an array of multiple events" do
        VCR.use_cassette "multple_get_events_response" do
          results = api.fetch_events_for_ad "89690"
          results.should be_a Array
          (results.length > 1).should be_true
          results.first.should be_a FullCircle::Event
        end
      end
    end<commit_msg>Moved connection outside of event block in api spec<commit_after>require 'spec_helper'
require 'vcr'

describe FullCircle::API do

  let!(:api){FullCircle::API.new(FullCircle::Connection.new("360durango.com"))}

  describe "#fetch_events_for_ad" do

    context "with one event" do
      it "returns an array of one event" do
        VCR.use_cassette "single_get_events_response" do
          results = api.fetch_events_for_ad "81213"
          results.should be_a Array
          results.first.should be_a FullCircle::Event
        end
      end

    end
    
    context "with multiple events" do
      it "returns an array of multiple events" do
        VCR.use_cassette "multple_get_events_response" do
          results = api.fetch_events_for_ad "89690"
          results.should be_a Array
          (results.length > 1).should be_true
          results.first.should be_a FullCircle::Event
        end
      end
    end
{'fraction_non_alphanumeric': 0.07505518763796909, 'fraction_numerical': 0.01545253863134658, 'mean_word_length': 2.647887323943662, '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': '4484922', 'n_tokens_mistral': 580, 'n_tokens_neox': 551, 'n_words': 147}