aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUģis Ozols <ugis.ozolss@gmail.com>2014-01-20 11:25:47 +0200
committerUģis Ozols <ugis.ozolss@gmail.com>2014-01-20 11:25:47 +0200
commit249af183145b1608686528255af9c031485683b8 (patch)
treeade3dcf168e5bf700154228044d588615e991975 /spec
parenta8b5bce609089af8795768230c7dd3a9b87cd5e0 (diff)
parentd891009d8b26cbccfc7fcdec645e1e2382c641bc (diff)
downloadrefinerycms-blog-249af183145b1608686528255af9c031485683b8.tar.gz
refinerycms-blog-249af183145b1608686528255af9c031485683b8.tar.bz2
refinerycms-blog-249af183145b1608686528255af9c031485683b8.zip
Merge branch 'master' into rails4
Conflicts: app/helpers/refinery/blog/controller_helper.rb app/models/refinery/blog/post.rb
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/blog_posts.rb1
-rw-r--r--spec/helpers/refinery/blog/controller_helper_spec.rb27
-rw-r--r--spec/models/refinery/blog/post_spec.rb6
3 files changed, 31 insertions, 3 deletions
diff --git a/spec/factories/blog_posts.rb b/spec/factories/blog_posts.rb
index ff4cf16..51c6b8a 100644
--- a/spec/factories/blog_posts.rb
+++ b/spec/factories/blog_posts.rb
@@ -3,7 +3,6 @@ FactoryGirl.define do
sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
draft false
- tag_list "chicago, shopping, fun times"
published_at Time.now
author { FactoryGirl.create(:refinery_user) }
diff --git a/spec/helpers/refinery/blog/controller_helper_spec.rb b/spec/helpers/refinery/blog/controller_helper_spec.rb
new file mode 100644
index 0000000..732f2bd
--- /dev/null
+++ b/spec/helpers/refinery/blog/controller_helper_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+module Refinery
+ module Blog
+ describe ControllerHelper do
+ describe "#find_tags" do
+ let(:tags) { helper.find_tags }
+
+ context "with draft posts" do
+ let!(:blog_post) { FactoryGirl.create(:blog_post, :draft => true, :tag_list => "first, second" ) }
+
+ it "does not return tags" do
+ expect(tags).to be_empty
+ end
+ end
+
+ context "with live posts" do
+ let!(:blog_post) { FactoryGirl.create(:blog_post, :tag_list => "first, second" ) }
+
+ it "does return tags" do
+ expect(tags).to_not be_empty
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb
index 49bfecd..8b156cb 100644
--- a/spec/models/refinery/blog/post_spec.rb
+++ b/spec/models/refinery/blog/post_spec.rb
@@ -42,8 +42,10 @@ module Refinery
it "acts as taggable" do
post.should respond_to(:tag_list)
- #the factory has default tags, including 'chicago'
- post.tag_list.should include("chicago")
+ post.tag_list = "refinery, cms"
+ post.save!
+
+ post.tag_list.should include("refinery")
end
end