aboutsummaryrefslogtreecommitdiffstats
path: root/spec/requests/refinery/admin/blog/comments_spec.rb
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2011-09-03 22:09:51 -0700
committerPhilip Arndt <parndt@gmail.com>2011-09-03 22:09:51 -0700
commit40be4f71ee425ee55ecedea96ff2b0dc510d71db (patch)
tree3ba02acc7861ef51045f0196dff6bac9efda40d5 /spec/requests/refinery/admin/blog/comments_spec.rb
parent80ca7c1bf99befac70803309e542a4db54f1f198 (diff)
parent6212e60f9e4d144f9a136f6c82b33abd47ddb237 (diff)
downloadrefinerycms-blog-40be4f71ee425ee55ecedea96ff2b0dc510d71db.tar.gz
refinerycms-blog-40be4f71ee425ee55ecedea96ff2b0dc510d71db.tar.bz2
refinerycms-blog-40be4f71ee425ee55ecedea96ff2b0dc510d71db.zip
Merge pull request #126 from enmasse-entertainment/fix-comments
Fix comments
Diffstat (limited to 'spec/requests/refinery/admin/blog/comments_spec.rb')
-rw-r--r--spec/requests/refinery/admin/blog/comments_spec.rb124
1 files changed, 124 insertions, 0 deletions
diff --git a/spec/requests/refinery/admin/blog/comments_spec.rb b/spec/requests/refinery/admin/blog/comments_spec.rb
new file mode 100644
index 0000000..a0213f6
--- /dev/null
+++ b/spec/requests/refinery/admin/blog/comments_spec.rb
@@ -0,0 +1,124 @@
+require "spec_helper"
+
+module Refinery
+ describe "AdminBlogComments" do
+ login_refinery_user
+
+ describe "#index" do
+ context "when has no new unapproved comments" do
+ before(:each) do
+ BlogComment.delete_all
+ visit refinery_admin_blog_comments_path
+ end
+
+ it "should list no comments" do
+ visit refinery_admin_blog_comments_path
+
+ page.should have_content('there are no new comments')
+ end
+ end
+
+ context "when has new unapproved comments" do
+ let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
+ before(:each) { visit refinery_admin_blog_comments_path }
+
+ it "should list comments" do
+ page.should have_content(blog_comment.body)
+ page.should have_content(blog_comment.name)
+ end
+
+ it "should allow me to approve a comment" do
+ click_link "Approve this comment"
+
+ page.should have_content("has been approved")
+ end
+
+ it "should allow me to reject a comment" do
+ click_link "Reject this comment"
+
+ page.should have_content("has been rejected")
+ end
+ end
+ end
+
+ describe "#approved" do
+ context "when has no approved comments" do
+ before(:each) do
+ BlogComment.delete_all
+ visit approved_refinery_admin_blog_comments_path
+ end
+
+ it "should list no comments" do
+ page.should have_content('there are no approved comments')
+ end
+ end
+
+ context "when has approved comments" do
+ let!(:blog_comment) do
+ FactoryGirl.create(:blog_comment,
+ :state => 'approved')
+ end
+ before(:each) { visit approved_refinery_admin_blog_comments_path }
+
+ it "should list comments" do
+ page.should have_content(blog_comment.body)
+ page.should have_content(blog_comment.name)
+ end
+
+ it "should allow me to reject a comment" do
+ click_link "Reject this comment"
+
+ page.should have_content("has been rejected")
+ end
+ end
+ end
+
+ describe "#rejected" do
+ context "when has no rejected comments" do
+ before(:each) do
+ BlogComment.delete_all
+ visit rejected_refinery_admin_blog_comments_path
+ end
+
+ it "should list no comments" do
+ page.should have_content('there are no rejected comments')
+ end
+ end
+
+ context "when has rejected comments" do
+ let!(:blog_comment) do
+ FactoryGirl.create(:blog_comment,
+ :state => 'rejected')
+ end
+ before(:each) { visit rejected_refinery_admin_blog_comments_path }
+
+ it "should list comments" do
+ page.should have_content(blog_comment.body)
+ page.should have_content(blog_comment.name)
+ end
+
+ it "should allow me to approve a comment" do
+ click_link "Approve this comment"
+
+ page.should have_content("has been approved")
+ end
+ end
+ end
+
+ describe "#show" do
+ let!(:blog_comment) { FactoryGirl.create(:blog_comment) }
+ before(:each) { visit refinery_admin_blog_comment_path(blog_comment) }
+
+ it "should display the comment" do
+ page.should have_content(blog_comment.body)
+ page.should have_content(blog_comment.name)
+ end
+
+ it "should allow me to approve the comment" do
+ click_link "Approve this comment"
+
+ page.should have_content("has been approved")
+ end
+ end
+ end
+end