diff options
author | Uģis Ozols <ugis.ozolss@gmail.com> | 2013-06-27 09:25:19 +0300 |
---|---|---|
committer | Uģis Ozols <ugis.ozolss@gmail.com> | 2013-06-27 09:25:19 +0300 |
commit | 7a76219d721d6e07a8b99dd3bbcfb87136d05052 (patch) | |
tree | 133c48dca98cd416eda5b9e185d28d5972cd7051 /spec/features/refinery/blog/admin/comments_spec.rb | |
parent | a8af874920fff981eb535d100d736f2a0017f266 (diff) | |
download | refinerycms-blog-7a76219d721d6e07a8b99dd3bbcfb87136d05052.tar.gz refinerycms-blog-7a76219d721d6e07a8b99dd3bbcfb87136d05052.tar.bz2 refinerycms-blog-7a76219d721d6e07a8b99dd3bbcfb87136d05052.zip |
Update specs due to recent Capybara/FactoryGirl upgrade.
Diffstat (limited to 'spec/features/refinery/blog/admin/comments_spec.rb')
-rw-r--r-- | spec/features/refinery/blog/admin/comments_spec.rb | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/spec/features/refinery/blog/admin/comments_spec.rb b/spec/features/refinery/blog/admin/comments_spec.rb new file mode 100644 index 0000000..08fe9df --- /dev/null +++ b/spec/features/refinery/blog/admin/comments_spec.rb @@ -0,0 +1,121 @@ +require "spec_helper" + +module Refinery + module Blog + module Admin + describe Comment do + refinery_login_with :refinery_user + + describe "#index" do + context "when has no new unapproved comments" do + before do + subject.class.delete_all + visit refinery.blog_admin_comments_path + end + + it "should list no comments" do + visit refinery.blog_admin_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 { visit refinery.blog_admin_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 do + subject.class.delete_all + visit refinery.approved_blog_admin_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 { visit refinery.approved_blog_admin_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 do + subject.class.delete_all + visit refinery.rejected_blog_admin_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 { visit refinery.rejected_blog_admin_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 { visit refinery.blog_admin_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 + end +end |