aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Davey <patrick.davey@resolvedigital.co.nz>2013-10-17 08:55:13 +1300
committerPatrick Davey <patrick.davey@resolvedigital.co.nz>2013-10-17 08:55:51 +1300
commit32bc0bb0e3adb0a3ce025724b51b7d413a554e27 (patch)
tree7f34da0539a212a885294ded919d74cbaae75f91
parent5ae082d79e554d3449083aa70ef64ef5d677759a (diff)
downloadrefinerycms-blog-32bc0bb0e3adb0a3ce025724b51b7d413a554e27.tar.gz
refinerycms-blog-32bc0bb0e3adb0a3ce025724b51b7d413a554e27.tar.bz2
refinerycms-blog-32bc0bb0e3adb0a3ce025724b51b7d413a554e27.zip
Restricting tags to live posts
-rw-r--r--app/helpers/refinery/blog/controller_helper.rb2
-rw-r--r--spec/helpers/refinery/blog/controller_helper_spec.rb25
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..89eeaad
--- /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) }
+ it "does not return tags" do
+ tags.should be_empty
+ end
+ end
+
+ context "with live posts" do
+ let!(:blog_post) { FactoryGirl.create(:blog_post) }
+
+ it "does not return tags" do
+ tags.should_not be_empty
+ end
+ end
+ end
+ end
+ end
+end