<commit_before># encoding: utf-8

require File.dirname(__FILE__) + '/../spec_helper'

describe Backup::Storage::Dropbox do

  let(:db) do
    Backup::Storage::Dropbox.new do |db|
      db.api_key     = 'my_api_key'
      db.api_secret  = 'my_secret'
      db.keep        = 20
      db.timeout     = 500
    end
  end

  let(:connection) do
    c = mock("Dropbox::Session")
    db.stubs(:connection).returns(c); c
  end

  before do
    Backup::Logger.stubs(:warn)
    Backup::Configuration::Storage::Dropbox.clear_defaults!
  end

  it 'should have defined the configuration properly' do
    db.api_key.should     == 'my_api_key'
    db.api_secret.should  == 'my_secret'
    db.path.should        == 'backups'
    db.keep.should        == 20
    db.timeout.should     == 500
  end

  it 'should overwrite the default timeout' do
    db = Backup::Storage::Dropbox.new do |db|<commit_msg>Stub out STDIN.gets otherwise the tests hang and error out after 3 minutes.<commit_after># encoding: utf-8

require File.dirname(__FILE__) + '/../spec_helper'

describe Backup::Storage::Dropbox do

  let(:db) do
    Backup::Storage::Dropbox.new do |db|
      db.api_key     = 'my_api_key'
      db.api_secret  = 'my_secret'
      db.keep        = 20
      db.timeout     = 500
    end
  end

  let(:connection) do
    c = mock("Dropbox::Session")
    db.stubs(:connection).returns(c); c
  end

  before do
    Backup::Logger.stubs(:warn)
    Backup::Configuration::Storage::Dropbox.clear_defaults!
    STDIN.stubs(:gets)
  end

  it 'should have defined the configuration properly' do
    db.api_key.should     == 'my_api_key'
    db.api_secret.should  == 'my_secret'
    db.path.should        == 'backups'
    db.keep.should        == 20
    db.timeout.should     == 500
  end

  it 'should overwrite the default timeout' do
    db = Backup::Storage::Dropbox.new do |db|
{'fraction_non_alphanumeric': 0.12385568120624664, 'fraction_numerical': 0.012385568120624663, 'mean_word_length': 2.723446893787575, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4526391', 'n_tokens_mistral': 653, 'n_tokens_neox': 616, 'n_words': 144}