<commit_before>require 'rails_helper'
require_relative '../../app/poro/broadcast'

describe Broadcast do
  it 'finds the correct health center' do
    broadcast = Broadcast.new
    health_center = HealthCenter.create(phone_number: "+15555555555")
    message = OpenStruct.new(:from => "+15555555555")
    broadcast.send(:find_health_center_by_message, message)

    expect(broadcast.health_center).to eq(health_center)
  end

  it 'it creates the client' do
    broadcast = Broadcast.new
    account = broadcast.send(:create_client)

    expect(account.class).to eq(Twilio::REST::Account)
  end

  it 'finds all the posts agents' do
    broadcast = Broadcast.new
    health_center = HealthCenter.create(phone_number: "+15555555555")
    health_post = health_center.health_posts.create(phone_number: "+15555555555")
    agent = health_post.agents.create(phone_number: "+12154106125")

    broadcast.instance_variable_set("@health_center", health_center)
    agents = broadcast.send(:agents)

    expect(agents.first.first.class).to eq(Agent)
    expect(agents.first.first.phone_number).to eq("+12154106125")
  end
end

<commit_msg>fix overcompensation with double firsts on AR proxy in array<commit_after>require 'rails_helper'
require_relative '../../app/poro/broadcast'

describe Broadcast do
  it 'finds the correct health center' do
    broadcast = Broadcast.new
    health_center = HealthCenter.create(phone_number: "+15555555555")
    message = OpenStruct.new(:from => "+15555555555")
    broadcast.send(:find_health_center_by_message, message)

    expect(broadcast.health_center).to eq(health_center)
  end

  it 'it creates the client' do
    broadcast = Broadcast.new
    account = broadcast.send(:create_client)

    expect(account.class).to eq(Twilio::REST::Account)
  end

  it 'finds all the posts agents' do
    broadcast = Broadcast.new
    health_center = HealthCenter.create(phone_number: "+15555555555")
    health_post = health_center.health_posts.create(phone_number: "+15555555555")
    agent = health_post.agents.create(phone_number: "+12154106125")

    broadcast.instance_variable_set("@health_center", health_center)
    agents = broadcast.send(:agents)

    expect(agents.first.class).to eq(Agent)
    expect(agents.first.phone_number).to eq("+12154106125")
  end
end


{'fraction_non_alphanumeric': 0.11067538126361656, 'fraction_numerical': 0.05751633986928104, 'mean_word_length': 4.711442786069652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, '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': '7433553', 'n_tokens_mistral': 812, 'n_tokens_neox': 711, 'n_words': 145}