diff options
author | Joe Sak <joe@joesak.com> | 2010-08-09 14:05:16 -0500 |
---|---|---|
committer | Joe Sak <joe@joesak.com> | 2010-08-09 14:05:16 -0500 |
commit | be4c8c3836e2d61edd516cac9ba1f4f0cb1ddf3b (patch) | |
tree | 4cee54987ab62db9268a5e96281910cf0cd871cd /spec/models | |
parent | 4a25cde49f710adcefcb644b418a94d3d5339dbd (diff) | |
download | refinerycms-blog-be4c8c3836e2d61edd516cac9ba1f4f0cb1ddf3b.tar.gz refinerycms-blog-be4c8c3836e2d61edd516cac9ba1f4f0cb1ddf3b.tar.bz2 refinerycms-blog-be4c8c3836e2d61edd516cac9ba1f4f0cb1ddf3b.zip |
Converted to factory_girl use, a little refactored
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/blog_categories_spec.rb | 18 | ||||
-rw-r--r-- | spec/models/blog_comments_spec.rb | 18 | ||||
-rw-r--r-- | spec/models/blog_posts_spec.rb | 15 |
3 files changed, 41 insertions, 10 deletions
diff --git a/spec/models/blog_categories_spec.rb b/spec/models/blog_categories_spec.rb index 14d0dcc..d97172c 100644 --- a/spec/models/blog_categories_spec.rb +++ b/spec/models/blog_categories_spec.rb @@ -1,8 +1,20 @@ require 'spec_helper' describe BlogCategory do - it "initializes" do - blog = BlogCategory.new - blog.should_not be_nil + context "wiring up" do + + before(:each) do + @category = Factory(:blog_category) + end + + it "saves" do + @category.should_not be_nil + end + + it "has a blog post" do + BlogPost.last.categories.should include(@category) + end + end + end
\ No newline at end of file diff --git a/spec/models/blog_comments_spec.rb b/spec/models/blog_comments_spec.rb index 43daf7d..145626d 100644 --- a/spec/models/blog_comments_spec.rb +++ b/spec/models/blog_comments_spec.rb @@ -1,8 +1,20 @@ require 'spec_helper' describe BlogComment do - it "initializes" do - blog = BlogComment.new - blog.should_not be_nil + + context "wiring up" do + + before(:each) do + @comment = Factory(:blog_comment) + end + + it "saves" do + @comment.should_not be_nil + end + + it "has a blog post" do + @comment.post.should_not be_nil + end + end end
\ No newline at end of file diff --git a/spec/models/blog_posts_spec.rb b/spec/models/blog_posts_spec.rb index f9629b0..a334c73 100644 --- a/spec/models/blog_posts_spec.rb +++ b/spec/models/blog_posts_spec.rb @@ -1,8 +1,15 @@ require 'spec_helper' describe BlogPost do - it "initializes" do - blog = BlogPost.new - blog.should_not be_nil - end + context "wiring up" do + + before(:each) do + @post = Factory(:post) + end + + it "saves to the database" do + @post.should_not be_nil + end + + end end
\ No newline at end of file |