Skip to content

Commit

Permalink
Restricting tags to live posts
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Davey committed Oct 16, 2013
1 parent 5ae082d commit 32bc0bb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/refinery/blog/controller_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def find_all_blog_posts
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
Expand Down
25 changes: 25 additions & 0 deletions spec/helpers/refinery/blog/controller_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 32bc0bb

Please sign in to comment.