Sha256: 0194f80e4a7bebe69b1919c88a66bfa02270e8f0d63c525fce05bae2522d8487

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'
require File.dirname(__FILE__) + '/../../lib/twitter_archive/backends/blogger_archive.rb'

describe TwitterArchive::Backends::BloggerArchive do
  before(:all) do 
      puts " WARNING Not testing with live blogger, set TEST_BLOGGER to enable" unless ENV['TEST_BLOGGER']
  end

  before(:each) do
    @ba = TwitterArchive::Backends::BloggerArchive.new
    @config = YAML::load_file(ENV['HOME'] + '/.twitter_archive.yml')
    @twitter_response = YAML::load_file File.dirname(__FILE__) +'/../fixtures/twitter_response.yml'

    if(ENV['TEST_BLOGGER'])
      Net::HTTPS.stub!(:post_form).and_return(YAML::load_file(
        File.dirname(__FILE__) + '/../../fixtures/blogger_authenticate_response.yml'))
      GData
    end

  end

  it "should create an instance" do
    @ba.should be_an_instance_of(TwitterArchive::Backends::BloggerArchive)
  end

  it "should test post to blogger" do
    @config['blogger_title'] = "Testing twitter_archive"
    @ba.archive(@twitter_response['results'], @config)
  end

  it "should format html from the tweets" do
    body = @ba.format_post(@twitter_response['results'])

    body.should_not be_nil
  end

  it "should format time like google" do
    @ba.format_time("Sun, 28 Dec 2008 23:38:46 +0000").should eql "12/28/2008 at 11:38PM"
  end

  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csexton-twitter_archive-0.0.1 spec/backends/blogger_archive_spec.rb
csexton-twitter_archive-0.0.3 spec/backends/blogger_archive_spec.rb
csexton-twitter_archive-0.0.4 spec/backends/blogger_archive_spec.rb