Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Restricting tags to live posts #352

Merged
merged 2 commits into from

2 participants

@ugisozols
Owner

Hey @patrickdavey,

I just pushed 1ef84a1 which removes tag_list from the post factory. I did it because by looking at the specs you wrote it wasn't clear why there are tags for the posts that are not draft.

Could you please change your specs by adding tags manually and then testing if there are any? Thanks.

@patrickdavey

Hi @ugisozols ,

I've added the tags explicitly when creating the posts. I hope that's the change you were after? :)

Thanks,
Patrick

@ugisozols
Owner

Yes, that was exactly what I meant. Thank you!

@ugisozols ugisozols merged commit fbe6050 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 16, 2013
  1. @patrickdavey
Commits on Oct 18, 2013
  1. @patrickdavey
This page is out of date. Refresh to see the latest.
View
2  app/helpers/refinery/blog/controller_helper.rb
@@ -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
View
25 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
Something went wrong with that request. Please try again.