Sha256: 0210fe19b6fea7c9a3c4221613bb74922f49d3413dcaf850661162b8c8a0b499

Contents?: true

Size: 939 Bytes

Versions: 4

Compression:

Stored size: 939 Bytes

Contents

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

describe BlogPostsHandler do 
  include TwogSpecHelper
  include BlogPostsHandler

  before(:each) do
    entry = rss_entry
    entry.updated.content = Time.new
    @posts = [entry]
    @last_blog_post_tweeted = test_conf['last_blog_post_tweeted']
  end
  
  it "should determine that there is one new blog post to tweet" do
    posts = get_new_blog_posts(@posts, @last_blog_post_tweeted)
    posts.length.should == 1
  end

  it "should return zero if posts are nil" do
    posts = get_new_blog_posts(nil, @last_blog_post_tweeted)
    posts.length.should == 0
  end
  
  it "should return zero if no posts are passed" do
    posts = get_new_blog_posts([], @last_blog_post_tweeted)
    posts.length.should == 0
  end

  it "should return the posts if there is no last_blog_post_tweeted in the conf file" do
    posts = get_new_blog_posts(@posts, nil)
    posts.length.should == 1
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twog-0.3.0 spec/blog_posts_handler_spec.rb
twog-0.2.2 spec/blog_posts_handler_spec.rb
twog-0.2.1 spec/blog_posts_handler_spec.rb
twog-0.2.0 spec/blog_posts_handler_spec.rb