<commit_before>require 'helper'

describe "acceptance: the client" do

  let(:recipient) { "rcarver" }
  let(:label)     { "tweader" }
  let(:twitter)   { Tweader::Twitter.new }
  let(:api)       { GoogleReaderApi::Api.new(:email => ENV['GREMAIL'], :password => ENV['<PASSWORD>']) }
  let(:reader)    { Tweader::Reader.new(api, label) }
  let(:tweeter)   { Tweader::Tweeter.new(recipient, twitter) }
  let(:client)    { Tweader::Client.new(reader, tweeter) }

  it "reads and tweets" do
    client.tweet(5)
  end
end<commit_msg>configure twitter and protect against bad auth<commit_after>require 'helper'

describe "acceptance: the client" do

  let(:recipient) { "rcarver" }
  let(:label)     { "tweader" }

  let(:twitter_client) {
    Twitter::Client.new(
      :consumer_key       => ENV['TW_CONSUMER_KEY'],
      :consumer_secret    => ENV['TW_CONSUMER_SECRET'],
      :oauth_token        => ENV['TW_OAUTH_TOKEN'],
      :oauth_token_secret => ENV['TW_OAUTH_SECRET']
    )
  }
  let(:twitter) { Tweader::Twitter.new(twitter_client) }
  let(:tweeter) { Tweader::Tweeter.new(recipient, twitter) }

  let(:google_reader_api) {
    GoogleReaderApi::Api.new(
      :email    => ENV['GR_EMAIL'],
      :password => ENV['<PASSWORD>'])
  }
  let(:reader) { Tweader::Reader.new(google_reader_api, label) }

  let(:client) { Tweader::Client.new(reader, tweeter) }

  it "reads and tweets" do
    begin
      client.tweet(1)
    rescue GoogleLogin::ClientLogin::BadAuthentication
      skip "Google authentication failed"
    rescue Twitter::Error::BadRequest
      skip "Twitter authentication failed"
    end
  end
end
{'fraction_non_alphanumeric': 0.15179677819083023, 'fraction_numerical': 0.0012391573729863693, 'mean_word_length': 3.8644578313253013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '1339406', 'n_tokens_mistral': 595, 'n_tokens_neox': 566, 'n_words': 100}