From 5e91670a80f3f4ed50f54d3d8fdf2709d981e9c8 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Wed, 21 Sep 2011 00:56:54 -0700 Subject: Fix draft preview of blog posts --- spec/requests/refinery/blog/posts_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'spec/requests') diff --git a/spec/requests/refinery/blog/posts_spec.rb b/spec/requests/refinery/blog/posts_spec.rb index 7c5a90f..025586c 100644 --- a/spec/requests/refinery/blog/posts_spec.rb +++ b/spec/requests/refinery/blog/posts_spec.rb @@ -83,5 +83,27 @@ module Refinery end end end + + describe "#show draft preview" do + let(:blog_post) { FactoryGirl.create(:blog_post_draft) } + + context "when logged in as admin" do + it "should display the draft notification" do + visit blog_post_path(blog_post) + + page.should have_content('This page is NOT live for public viewing.') + end + end + + context "when not logged in as an admin" do + before(:each) { visit destroy_refinery_user_session_path } + + it "should not display the blog post" do + visit blog_post_path(blog_post) + + page.should have_content("The page you were looking for doesn't exist (404)") + end + end + end end end -- cgit v1.2.3