From d5ffea8e887799ccc30d9fa1e0a70b01c232abd0 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 00:29:36 -0600 Subject: test coverage for uncategorized blog posts scope --- spec/models/blog_posts_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec') diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index ef9d700..0ef9b0e 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -94,6 +94,18 @@ describe BlogPost do BlogPost.next(blog_post1).should == [blog_post2] end end + + describe "uncategorized scope" do + it "returns uncategorized posts if they exist" do + uncategorized_blog_post = Factory(:post) + categorized_blog_post = Factory(:post) + + categorized_blog_post.categories << Factory(:blog_category) + + BlogPost.uncategorized.should include uncategorized_blog_post + BlogPost.uncategorized.should_not include categorized_blog_post + end + end describe "#live?" do it "returns true if post is not in draft and it's published" do -- cgit v1.2.3