aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-01-17 16:56:03 +1300
committerPhilip Arndt <parndt@gmail.com>2012-01-17 16:56:24 +1300
commitb1e4fd00943a160f3eb6ce242463c0cc07a406fc (patch)
tree07fb750aa580b63d39c23589997956bf3a03594d /spec
parentb3a25c1b686d205fc6b8b409a8f90059ae6b934d (diff)
downloadrefinerycms-blog-b1e4fd00943a160f3eb6ce242463c0cc07a406fc.tar.gz
refinerycms-blog-b1e4fd00943a160f3eb6ce242463c0cc07a406fc.tar.bz2
refinerycms-blog-b1e4fd00943a160f3eb6ce242463c0cc07a406fc.zip
Fixed namespacing for Refinery conventions.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/refinery/blog/engine_spec.rb6
-rw-r--r--spec/models/refinery/blog/post_spec.rb26
-rw-r--r--spec/requests/refinery/blog/admin/comments_spec.rb5
-rw-r--r--spec/requests/refinery/blog/admin/posts_spec.rb10
-rw-r--r--spec/requests/refinery/blog/categories_spec.rb15
-rw-r--r--spec/requests/refinery/blog/posts_spec.rb29
6 files changed, 39 insertions, 52 deletions
diff --git a/spec/lib/refinery/blog/engine_spec.rb b/spec/lib/refinery/blog/engine_spec.rb
index eae2c3c..54a7eb5 100644
--- a/spec/lib/refinery/blog/engine_spec.rb
+++ b/spec/lib/refinery/blog/engine_spec.rb
@@ -9,14 +9,14 @@ module Refinery
end
it "sets the correct path for activity entries" do
- activity.url.should eq("edit_refinery_admin_blog_post_path")
+ activity.url.should eq("edit_refinery_blog_admin_post_path")
end
end
describe ".load_seed" do
it "is idempotent" do
- Refinery::Blog::Engine.load_seed
- Refinery::Blog::Engine.load_seed
+ Engine.load_seed
+ Engine.load_seed
Refinery::Page.where(:link_url => '/blog').count.should eq(1)
end
diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb
index 7167728..60a04ec 100644
--- a/spec/models/refinery/blog/post_spec.rb
+++ b/spec/models/refinery/blog/post_spec.rb
@@ -55,8 +55,8 @@ module Refinery
describe "by_archive scope" do
before do
- @blog_post1 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 11))
- @blog_post2 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 12))
+ @post1 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 11))
+ @post2 = FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 3, 12))
#2 months before
FactoryGirl.create(:blog_post, :published_at => Date.new(2011, 1, 10))
@@ -66,34 +66,34 @@ module Refinery
#check for this month
date = "03/2011"
subject.class.by_archive(Time.parse(date)).count.should be == 2
- subject.class.by_archive(Time.parse(date)).should == [@blog_post2, @blog_post1]
+ subject.class.by_archive(Time.parse(date)).should == [@post2, @post1]
end
end
describe "all_previous scope" do
before do
- @blog_post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 2.months)
- @blog_post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 1.month)
+ @post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 2.months)
+ @post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 1.month)
FactoryGirl.create(:blog_post, :published_at => Time.now)
end
it "returns all posts from previous months" do
subject.class.all_previous.count.should be == 2
- subject.class.all_previous.should == [@blog_post2, @blog_post1]
+ subject.class.all_previous.should == [@post2, @post1]
end
end
describe "live scope" do
before do
- @blog_post1 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -2))
- @blog_post2 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
+ @post1 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -2))
+ @post2 = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
FactoryGirl.create(:blog_post, :draft => true)
FactoryGirl.create(:blog_post, :published_at => Time.now + 1.minute)
end
it "returns all posts which aren't in draft and pub date isn't in future" do
subject.class.live.count.should be == 2
- subject.class.live.should == [@blog_post2, @blog_post1]
+ subject.class.live.should == [@post2, @post1]
end
end
@@ -128,22 +128,22 @@ module Refinery
describe "#next" do
before do
FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
- @blog_post = FactoryGirl.create(:blog_post)
+ @post = FactoryGirl.create(:blog_post)
end
it "returns next article when called on current article" do
- subject.class.last.next.should == @blog_post
+ subject.class.last.next.should == @post
end
end
describe "#prev" do
before do
FactoryGirl.create(:blog_post)
- @blog_post = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
+ @post = FactoryGirl.create(:blog_post, :published_at => Time.now.advance(:minutes => -1))
end
it "returns previous article when called on current article" do
- subject.class.first.prev.should == @blog_post
+ subject.class.first.prev.should == @post
end
end
diff --git a/spec/requests/refinery/blog/admin/comments_spec.rb b/spec/requests/refinery/blog/admin/comments_spec.rb
index b1a5afe..d56e1f1 100644
--- a/spec/requests/refinery/blog/admin/comments_spec.rb
+++ b/spec/requests/refinery/blog/admin/comments_spec.rb
@@ -19,7 +19,6 @@ module Refinery
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 }
@@ -54,7 +53,6 @@ module Refinery
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,
@@ -86,7 +84,6 @@ module Refinery
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,
@@ -110,12 +107,10 @@ module Refinery
describe "#show" do
let!(:blog_comment) { FactoryGirl.create(: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"
diff --git a/spec/requests/refinery/blog/admin/posts_spec.rb b/spec/requests/refinery/blog/admin/posts_spec.rb
index 6c50c37..219fd13 100644
--- a/spec/requests/refinery/blog/admin/posts_spec.rb
+++ b/spec/requests/refinery/blog/admin/posts_spec.rb
@@ -36,7 +36,7 @@ module Refinery
describe "create blog post" do
before(:each) do
fill_in "Title", :with => "This is my blog post"
- fill_in "blog_post_body", :with => "And I love it"
+ fill_in "post_body", :with => "And I love it"
check blog_category.title
click_button "Save"
end
@@ -53,7 +53,7 @@ module Refinery
subject.class.first.author.should eq(::Refinery::User.last)
end
- it "should save categories" do
+ it "should save categories", :focus => true do
subject.class.last.categories.count.should eq(1)
subject.class.last.categories.first.title.should eq(blog_category.title)
end
@@ -63,7 +63,7 @@ module Refinery
before(:each) do
@tag_list = "chicago, bikes, beers, babes"
fill_in "Title", :with => "This is a tagged blog post"
- fill_in "blog_post_body", :with => "And I also love it"
+ fill_in "post_body", :with => "And I also love it"
fill_in "Tags", :with => @tag_list
click_button "Save"
end
@@ -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 == blog_post_path(blog_post)
+ current_path.should == refinery_blog_post_path(blog_post)
page.should have_content(blog_post.title)
end
end
@@ -151,7 +151,7 @@ module Refinery
click_link "Create new post"
fill_in "Title", :with => "This is some other guy's blog post"
- fill_in "blog_post_body", :with => "I totally didn't write it."
+ fill_in "post_body", :with => "I totally didn't write it."
click_link "Advanced Options"
diff --git a/spec/requests/refinery/blog/categories_spec.rb b/spec/requests/refinery/blog/categories_spec.rb
index 48a3417..022d251 100644
--- a/spec/requests/refinery/blog/categories_spec.rb
+++ b/spec/requests/refinery/blog/categories_spec.rb
@@ -3,18 +3,17 @@ require "spec_helper"
module Refinery
describe "BlogCategories" do
login_refinery_user
-
+
context "has one category and post" do
before(:each) do
- @blog_post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post")
- @blog_category = FactoryGirl.create(:blog_category, :title => "Video Games")
- @blog_post.categories << @blog_category
- @blog_post.save!
+ @post = FactoryGirl.create(:blog_post, :title => "Refinery CMS blog post")
+ @category = FactoryGirl.create(:blog_category, :title => "Video Games")
+ @post.categories << @category
+ @post.save!
end
-
+
describe "show categories blog posts" do
- before(:each) { visit blog_category_path(@blog_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 f2c94b0..71a90f7 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 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 blog_rss_feed_path
+ get refinery_blog_rss_feed_path
response.should be_success
response.content_type.should eq("application/rss+xml")
@@ -25,17 +25,16 @@ module Refinery
context "when has tagged blog posts" do
before(:each) do
@tag_name = "chicago"
- @blog_post = FactoryGirl.create(:blog_post,
+ @post = FactoryGirl.create(:blog_post,
:title => "I Love my city",
:tag_list => @tag_name)
@tag = ::Refinery::Blog::Post.tag_counts_on(:tags).first
end
-
it "should have one tagged post" do
- visit 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(@blog_post.title)
+ page.should have_content(@post.title)
end
end
end
@@ -45,39 +44,35 @@ module Refinery
let(:blog_post) { FactoryGirl.create(:blog_post) }
it "should display the blog post" do
- visit 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
end
-
context "when has approved comments" do
let(:approved_comment) { FactoryGirl.create(:approved_comment) }
it "should display the comments" do
- visit 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}")
end
end
-
context "when has rejected comments" do
let(:rejected_comment) { FactoryGirl.create(:rejected_comment) }
it "should not display the comments" do
- visit blog_post_path(rejected_comment.post)
+ visit refinery_blog_post_path(rejected_comment.post)
page.should_not have_content(rejected_comment.body)
end
end
-
context "when has new comments" do
let(:blog_comment) { FactoryGirl.create(:blog_comment) }
it "should not display the comments" do
- visit blog_post_path(blog_comment.post)
+ visit refinery_blog_post_path(blog_comment.post)
page.should_not have_content(blog_comment.body)
end
@@ -86,20 +81,18 @@ module Refinery
describe "#show draft preview" do
let(:blog_post) { FactoryGirl.create(:blog_post_draft) }
-
context "when logged in as admin" do
it "should display the draft notification" do
- visit 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 }
it "should not display the blog post" do
- visit 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