diff options
-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..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 |