aboutsummaryrefslogtreecommitdiffstats
path: root/spec/requests/refinery/blog/admin/comments_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/refinery/blog/admin/comments_spec.rb')
-rw-r--r--spec/requests/refinery/blog/admin/comments_spec.rb86
1 files changed, 42 insertions, 44 deletions
diff --git a/spec/requests/refinery/blog/admin/comments_spec.rb b/spec/requests/refinery/blog/admin/comments_spec.rb
index d56e1f1..1f69327 100644
--- a/spec/requests/refinery/blog/admin/comments_spec.rb
+++ b/spec/requests/refinery/blog/admin/comments_spec.rb
@@ -5,115 +5,113 @@ module Refinery
module Admin
describe Comment do
login_refinery_user
-
- describe "#index" do
+
+ describe "#index" do
context "when has no new unapproved comments" do
- before(:each) do
+ before(:each) do
subject.class.delete_all
- visit refinery_blog_admin_comments_path
- end
-
+ 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')
+ 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(:each) { visit refinery_blog_admin_comments_path }
-
+ before(:each) { 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
+
+ describe "#approved" do
context "when has no approved comments" do
before(:each) do
subject.class.delete_all
- visit approved_refinery_blog_admin_comments_path
+ visit refinery.approved_blog_admin_comments_path
end
-
- it "should list no comments" do
- page.should have_content('there are no approved comments')
+
+ 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')
+ FactoryGirl.create(:blog_comment, :state => 'approved')
end
- before(:each) { visit approved_refinery_blog_admin_comments_path }
-
- it "should list comments" do
+ before(:each) { 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
+
+ describe "#rejected" do
context "when has no rejected comments" do
before(:each) do
subject.class.delete_all
- visit rejected_refinery_blog_admin_comments_path
+ visit refinery.rejected_blog_admin_comments_path
end
-
- it "should list no comments" do
- page.should have_content('there are no rejected comments')
+
+ 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')
+ FactoryGirl.create(:blog_comment, :state => 'rejected')
end
- before(:each) { visit rejected_refinery_blog_admin_comments_path }
-
- it "should list comments" do
+ before(:each) { 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(:each) { visit refinery_blog_admin_comment_path(blog_comment) }
+ before(:each) { 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