Sha256: 38199b9bfecd88ff141ed32699fdce9042d2f801fa4aedb7ebd30bbc3ece8cad

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

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

describe Twog do 
  include TwogSpecHelper
  include Twog::Twog

  it "should not tweet if there are no new blog posts" do
    stub!(:get_posts_to_tweet).with(test_conf).and_return([])
    stub!(:tweet).and_return(1)
    result = run(test_conf)
    result.should be nil
  end
  
  it "should parse the rss feed and tweet new blog posts" do
    entry = rss_entry
    stub!(:get_posts_to_tweet).with(test_conf).and_return([entry])
    stub!(:get_bitly_from)
    stub!(:tweet).and_return(1)
    result = run(test_conf)
    result.should == 1
  end

  it "should return nil if bitly username is nil" do
    conf = test_conf
    conf['bitly_username'] = nil
    get_bitly_from(conf).should be nil
  end
  
  it "should return nil if bitly api key is nil" do
    conf = test_conf
    conf['bitly_username'] = nil
    get_bitly_from(conf).should be nil
  end

  it "should return nil if bitly api key is nil" do
    Bitly.stub!(:new).and_return("hello")
    get_bitly_from(test_conf).should == "hello"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twog-0.3.1 spec/twog_spec.rb