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

describe Tumblife do
  before do
    @api_key = 'consumer key'
    @consumer = OAuth::Consumer.new(@api_key, 'consumer secret', site: 'http://api.tumblr.com')
    @access_token = OAuth::AccessToken.new(@consumer, 'oauth token', 'oauth token secret')
    @client = Tumblife.new(@access_token)
  end

  context :api do
    it 'should respond to info' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/info', api_key: @api_key)
      @client.info 'mitukiii.tumblr.com'
    end

    it 'should respond to avatar' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/avatar', {})
      @client.avatar 'mitukiii.tumblr.com'
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/avatar', size: 512)
      @client.avatar 'mitukiii.tumblr.com', size: 512
    end

    it 'should respond to followers' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/followers', {})
      @client.followers 'mitukiii.tumblr.com'
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/followers', limit: 10)
      @client.followers 'mitukiii.tumblr.com', limit: 10
    end

    it 'should respond to posts' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/posts', api_key: @api_key)<commit_msg>Add spec that change how to use library.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Tumblife do
  before do
    @api_key = 'consumer key'
    Tumblife.configure do |config|
      config.consumer_key = @api_key
      config.consumer_secret = 'consumer secret'
      config.oauth_token = '<PASSWORD>'
      config.oauth_token_secret = 'oauth token secret'
    end
    @client = Tumblife.client
  end

  context :api do
    it 'should respond to info' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/info', api_key: @api_key)
      @client.info 'mitukiii.tumblr.com'
    end

    it 'should respond to avatar' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/avatar', {})
      @client.avatar 'mitukiii.tumblr.com'
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/avatar', size: 512)
      @client.avatar 'mitukiii.tumblr.com', size: 512
    end

    it 'should respond to followers' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/followers', {})
      @client.followers 'mitukiii.tumblr.com'
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/followers', limit: 10)
      @client.followers 'mitukiii.tumblr.com', limit: 10
    end

    it 'should respond to posts' do
      @client.should_receive(:get).with('/v2/blog/mitukiii.tumblr.com/posts', api_key: @api_key)
{'fraction_non_alphanumeric': 0.14602720114531137, 'fraction_numerical': 0.01145311381531854, 'mean_word_length': 3.612211221122112, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1319134', 'n_tokens_mistral': 1070, 'n_tokens_neox': 970, 'n_words': 178}