From 32bc0bb0e3adb0a3ce025724b51b7d413a554e27 Mon Sep 17 00:00:00 2001 From: Patrick Davey Date: Thu, 17 Oct 2013 08:55:13 +1300 Subject: Restricting tags to live posts --- .../refinery/blog/controller_helper_spec.rb | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 spec/helpers/refinery/blog/controller_helper_spec.rb (limited to 'spec/helpers/refinery') 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 -- cgit v1.2.3 From c6f4616844fd2861c95fce383bdaefa1fbc5cf62 Mon Sep 17 00:00:00 2001 From: Patrick Davey Date: Fri, 18 Oct 2013 14:18:41 +1300 Subject: Explicitly setting tag list in tests --- spec/helpers/refinery/blog/controller_helper_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/helpers/refinery') diff --git a/spec/helpers/refinery/blog/controller_helper_spec.rb b/spec/helpers/refinery/blog/controller_helper_spec.rb index 89eeaad..727e8b4 100644 --- a/spec/helpers/refinery/blog/controller_helper_spec.rb +++ b/spec/helpers/refinery/blog/controller_helper_spec.rb @@ -6,14 +6,14 @@ module Refinery let(:tags) { helper.find_tags } context "with draft posts" do - let!(:blog_post) { FactoryGirl.create(:blog_post, :draft => true) } + 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) } + let!(:blog_post) { FactoryGirl.create(:blog_post, :tag_list => "first, second" ) } it "does not return tags" do tags.should_not be_empty -- cgit v1.2.3 From 77f65da471906e1b2a8ec06720c47cf54baffd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ug=CC=A7is=20Ozols?= Date: Fri, 18 Oct 2013 07:58:59 +0300 Subject: Use expect syntax. --- spec/helpers/refinery/blog/controller_helper_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/helpers/refinery') diff --git a/spec/helpers/refinery/blog/controller_helper_spec.rb b/spec/helpers/refinery/blog/controller_helper_spec.rb index 727e8b4..732f2bd 100644 --- a/spec/helpers/refinery/blog/controller_helper_spec.rb +++ b/spec/helpers/refinery/blog/controller_helper_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' + module Refinery module Blog describe ControllerHelper do @@ -7,16 +8,17 @@ module Refinery 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 + expect(tags).to 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 + it "does return tags" do + expect(tags).to_not be_empty end end end -- cgit v1.2.3