aboutsummaryrefslogtreecommitdiffstats
path: root/spec/requests/refinery/blog
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-02-01 16:34:06 +1300
committerPhilip Arndt <parndt@gmail.com>2012-02-01 16:34:06 +1300
commit33bfa4dd231e4042456b3a70059c9cf57af858cf (patch)
treed51f175d17423e128cf23b294686fbb361a58189 /spec/requests/refinery/blog
parent30ebf2d338cdd1eff3f78fe4f865c98c02b0ad7e (diff)
downloadrefinerycms-blog-33bfa4dd231e4042456b3a70059c9cf57af858cf.tar.gz
refinerycms-blog-33bfa4dd231e4042456b3a70059c9cf57af858cf.tar.bz2
refinerycms-blog-33bfa4dd231e4042456b3a70059c9cf57af858cf.zip
Added support for new code in Refinery CMS since resolve/refinerycms#1234
Diffstat (limited to 'spec/requests/refinery/blog')
-rw-r--r--spec/requests/refinery/blog/admin/categories_spec.rb2
-rw-r--r--spec/requests/refinery/blog/admin/comments_spec.rb86
-rw-r--r--spec/requests/refinery/blog/admin/menu_spec.rb2
-rw-r--r--spec/requests/refinery/blog/admin/posts_spec.rb18
-rw-r--r--spec/requests/refinery/blog/categories_spec.rb2
-rw-r--r--spec/requests/refinery/blog/posts_spec.rb22
6 files changed, 65 insertions, 67 deletions
diff --git a/spec/requests/refinery/blog/admin/categories_spec.rb b/spec/requests/refinery/blog/admin/categories_spec.rb
index 60a92ab..fd18cc0 100644
--- a/spec/requests/refinery/blog/admin/categories_spec.rb
+++ b/spec/requests/refinery/blog/admin/categories_spec.rb
@@ -6,7 +6,7 @@ describe "Categories admin" do
let(:title) { "lol" }
it "can create categories" do
- visit refinery_admin_root_path
+ visit refinery.admin_root_path
within("nav#menu") { click_link "Blog" }
within("nav.multilist") { click_link "Create new category" }
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
diff --git a/spec/requests/refinery/blog/admin/menu_spec.rb b/spec/requests/refinery/blog/admin/menu_spec.rb
index b02a473..8b4b011 100644
--- a/spec/requests/refinery/blog/admin/menu_spec.rb
+++ b/spec/requests/refinery/blog/admin/menu_spec.rb
@@ -4,7 +4,7 @@ describe "Blog menu entry" do
login_refinery_user
it "is highlighted when managing the blog" do
- visit refinery_admin_root_path
+ visit refinery.admin_root_path
within("#menu") { click_link "Blog" }
diff --git a/spec/requests/refinery/blog/admin/posts_spec.rb b/spec/requests/refinery/blog/admin/posts_spec.rb
index 219fd13..e1ffe0d 100644
--- a/spec/requests/refinery/blog/admin/posts_spec.rb
+++ b/spec/requests/refinery/blog/admin/posts_spec.rb
@@ -12,7 +12,7 @@ module Refinery
before(:each) { subject.class.destroy_all }
describe "blog post listing" do
- before(:each) { visit refinery_blog_admin_posts_path }
+ before(:each) { visit refinery.blog_admin_posts_path }
it "invites to create new post" do
page.should have_content("There are no Blog Posts yet. Click \"Create new post\" to add your first blog post.")
@@ -21,7 +21,7 @@ module Refinery
describe "new blog post form" do
before(:each) do
- visit refinery_blog_admin_posts_path
+ visit refinery.blog_admin_posts_path
click_link "Create new post"
end
@@ -53,7 +53,7 @@ module Refinery
subject.class.first.author.should eq(::Refinery::User.last)
end
- it "should save categories", :focus => true do
+ it "should save categories" do
subject.class.last.categories.count.should eq(1)
subject.class.last.categories.first.title.should eq(blog_category.title)
end
@@ -87,14 +87,14 @@ module Refinery
let!(:blog_post) { FactoryGirl.create(:blog_post) }
describe "blog post listing" do
- before(:each) { visit refinery_blog_admin_posts_path }
+ before(:each) { visit refinery.blog_admin_posts_path }
describe "edit blog post" do
it "should succeed" do
page.should have_content(blog_post.title)
click_link("Edit this blog post")
- current_path.should == edit_refinery_blog_admin_post_path(blog_post)
+ current_path.should == refinery.edit_blog_admin_post_path(blog_post)
fill_in "Title", :with => "hax0r"
click_button "Save"
@@ -118,7 +118,7 @@ module Refinery
it "redirects to blog post in the frontend" do
click_link "View this blog post live"
- current_path.should == refinery_blog_post_path(blog_post)
+ current_path.should == refinery.blog_post_path(blog_post)
page.should have_content(blog_post.title)
end
end
@@ -126,7 +126,7 @@ module Refinery
context "when uncategorized post" do
it "shows up in the list" do
- visit uncategorized_refinery_blog_admin_posts_path
+ visit refinery.uncategorized_blog_admin_posts_path
page.should have_content(blog_post.title)
end
end
@@ -136,7 +136,7 @@ module Refinery
blog_post.categories << blog_category
blog_post.save!
- visit uncategorized_refinery_blog_admin_posts_path
+ visit refinery.uncategorized_blog_admin_posts_path
page.should_not have_content(blog_post.title)
end
end
@@ -147,7 +147,7 @@ module Refinery
describe "create blog post with alternate author" do
before(:each) do
- visit refinery_blog_admin_posts_path
+ visit refinery.blog_admin_posts_path
click_link "Create new post"
fill_in "Title", :with => "This is some other guy's blog post"
diff --git a/spec/requests/refinery/blog/categories_spec.rb b/spec/requests/refinery/blog/categories_spec.rb
index 022d251..149723c 100644
--- a/spec/requests/refinery/blog/categories_spec.rb
+++ b/spec/requests/refinery/blog/categories_spec.rb
@@ -13,7 +13,7 @@ module Refinery
end
describe "show categories blog posts" do
- before(:each) { visit refinery_blog_category_path(@category) }
+ before(:each) { visit refinery.blog_category_path(@category) }
it "should displays categories blog posts" do
page.should have_content("Refinery CMS blog post")
page.should have_content("Video Games")
diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb
index 471a460..815ca26 100644
--- a/spec/requests/refinery/blog/posts_spec.rb
+++ b/spec/requests/refinery/blog/posts_spec.rb
@@ -8,13 +8,13 @@ module Refinery
let!(:blog_post) { FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post") }
it "should display blog post" do
- visit refinery_blog_post_path(blog_post)
+ visit refinery.blog_post_path(blog_post)
page.should have_content(blog_post.title)
end
it "should display the blog rss feed" do
- get refinery_blog_rss_feed_path
+ get refinery.blog_rss_feed_path
response.should be_success
response.content_type.should eq("application/rss+xml")
@@ -31,7 +31,7 @@ module Refinery
@tag = ::Refinery::Blog::Post.tag_counts_on(:tags).first
end
it "should have one tagged post" do
- visit refinery_blog_tagged_posts_path(@tag.id, @tag_name.parameterize)
+ visit refinery.blog_tagged_posts_path(@tag.id, @tag_name.parameterize)
page.should have_content(@tag_name)
page.should have_content(@post.title)
@@ -44,7 +44,7 @@ module Refinery
let(:blog_post) { FactoryGirl.create(:blog_post) }
it "should display the blog post" do
- visit refinery_blog_post_path(blog_post)
+ visit refinery.blog_post_path(blog_post)
page.should have_content(blog_post.title)
page.should have_content(blog_post.body)
end
@@ -53,7 +53,7 @@ module Refinery
let(:approved_comment) { FactoryGirl.create(:approved_comment) }
it "should display the comments" do
- visit refinery_blog_post_path(approved_comment.post)
+ visit refinery.blog_post_path(approved_comment.post)
page.should have_content(approved_comment.body)
page.should have_content("Posted by #{approved_comment.name}")
@@ -63,7 +63,7 @@ module Refinery
let(:rejected_comment) { FactoryGirl.create(:rejected_comment) }
it "should not display the comments" do
- visit refinery_blog_post_path(rejected_comment.post)
+ visit refinery.blog_post_path(rejected_comment.post)
page.should_not have_content(rejected_comment.body)
end
@@ -72,7 +72,7 @@ module Refinery
let(:blog_comment) { FactoryGirl.create(:blog_comment) }
it "should not display the comments" do
- visit refinery_blog_post_path(blog_comment.post)
+ visit refinery.blog_post_path(blog_comment.post)
page.should_not have_content(blog_comment.body)
end
@@ -85,7 +85,7 @@ module Refinery
let(:body) { "Witty comment." }
before do
- visit refinery_blog_post_path(blog_post)
+ visit refinery.blog_post_path(blog_post)
fill_in "Name", :with => name
fill_in "Email", :with => email
@@ -107,16 +107,16 @@ module Refinery
let(:blog_post) { FactoryGirl.create(:blog_post_draft) }
context "when logged in as admin" do
it "should display the draft notification" do
- visit refinery_blog_post_path(blog_post)
+ visit refinery.blog_post_path(blog_post)
page.should have_content('This page is NOT live for public viewing.')
end
end
context "when not logged in as an admin" do
- before(:each) { visit destroy_refinery_user_session_path }
+ before(:each) { visit refinery.destroy_refinery_user_session_path }
it "should not display the blog post" do
- visit refinery_blog_post_path(blog_post)
+ visit refinery.blog_post_path(blog_post)
page.should have_content("The page you were looking for doesn't exist (404)")
end