Sha256: 2e64ddf0219e1bd6a41d71398e1dc8c534409a0b9f5a533fc86a71d2e98dd465
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
require File.join(File.dirname(__FILE__), "/../spec_helper") describe BlogPostsHandler do include BlogPostsHandler before(:each) do post = Twog::Post.new(double('', pubDate: Time.now, link: 'http://tinyurl.com')) @posts = [post] @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) expect(posts.length).to eq(1) end it "should return zero if posts are nil" do posts = get_new_blog_posts(nil, @last_blog_post_tweeted) expect(posts.length).to eq(0) end it "should return zero if no posts are passed" do posts = get_new_blog_posts([], @last_blog_post_tweeted) expect(posts.length).to eq(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) expect(posts.length).to eq(1) end it "should return zero posts if the date is older than the last blog post date tweeted" do post = Twog::Post.new(double('', pubDate: (Date.parse(@last_blog_post_tweeted.to_s) - 10).to_s, link: 'http://tinyurl.com')) @posts = [post] posts = get_new_blog_posts(@posts, @last_blog_post_tweeted) expect(posts.length).to eq(0) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
twog-0.3.5 | spec/twog/blog_posts_handler_spec.rb |
twog-0.3.4 | spec/twog/blog_posts_handler_spec.rb |
twog-0.3.3 | spec/twog/blog_posts_handler_spec.rb |