diff options
author | Uģis Ozols <ugis@ugisozols.com> | 2013-10-17 21:55:13 -0700 |
---|---|---|
committer | Uģis Ozols <ugis@ugisozols.com> | 2013-10-17 21:55:13 -0700 |
commit | fbe605051bc98dc609a0cb3ea01abbec084caa6b (patch) | |
tree | c89fe158c82896c58549859ed750b6e9093299c7 | |
parent | 1ef84a1d5b55304f1a6e365c944ecc1d222ab8e3 (diff) | |
parent | c6f4616844fd2861c95fce383bdaefa1fbc5cf62 (diff) | |
download | refinerycms-blog-fbe605051bc98dc609a0cb3ea01abbec084caa6b.tar.gz refinerycms-blog-fbe605051bc98dc609a0cb3ea01abbec084caa6b.tar.bz2 refinerycms-blog-fbe605051bc98dc609a0cb3ea01abbec084caa6b.zip |
Merge pull request #352 from patrickdavey/restrict_tags_to_live_posts
Restricting tags to live posts
-rw-r--r-- | app/helpers/refinery/blog/controller_helper.rb | 2 | ||||
-rw-r--r-- | spec/helpers/refinery/blog/controller_helper_spec.rb | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/app/helpers/refinery/blog/controller_helper.rb b/app/helpers/refinery/blog/controller_helper.rb index 87d5447..edbf934 100644 --- a/app/helpers/refinery/blog/controller_helper.rb +++ b/app/helpers/refinery/blog/controller_helper.rb @@ -19,7 +19,7 @@ module Refinery end def find_tags - @tags = Refinery::Blog::Post.tag_counts_on(:tags) + @tags = Refinery::Blog::Post.live.tag_counts_on(:tags) end def find_all_blog_categories @categories = Refinery::Blog::Category.translated 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..727e8b4 --- /dev/null +++ b/spec/helpers/refinery/blog/controller_helper_spec.rb @@ -0,0 +1,25 @@ +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 + tags.should be_empty + end + end + + context "with live posts" do + let!(:blog_post) { FactoryGirl.create(:blog_post, :tag_list => "first, second" ) } + + it "does not return tags" do + tags.should_not be_empty + end + end + end + end + end +end |