From 04b49b2371c555363c25081564f02890dc85fa3b Mon Sep 17 00:00:00 2001 From: Pete Higgins Date: Wed, 14 Dec 2011 15:01:04 -0800 Subject: Allow configurable author for blog posts. --- spec/requests/refinery/admin/blog/posts_spec.rb | 30 ++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/requests/refinery/admin/blog/posts_spec.rb b/spec/requests/refinery/admin/blog/posts_spec.rb index 08fbab9..53372b1 100644 --- a/spec/requests/refinery/admin/blog/posts_spec.rb +++ b/spec/requests/refinery/admin/blog/posts_spec.rb @@ -48,7 +48,7 @@ module Refinery end it "should belong to me" do - ::Refinery::Blog::Post.first.author.login.should eq(::Refinery::User.last.login) + ::Refinery::Blog::Post.first.author.should eq(::Refinery::User.last) end it "should save categories" do @@ -139,5 +139,33 @@ module Refinery end end end + + context "with multiple users" do + let!(:other_guy) { Factory(:refinery_user, :username => "Other Guy") } + + describe "create blog post with alternate author" do + before(:each) do + visit refinery_admin_blog_posts_path + click_link "Create new post" + + fill_in "Title", :with => "This is some other guy's blog post" + fill_in "blog_post_body", :with => "I totally didn't write it." + + click_link "Advanced Options" + + select other_guy.username, :from => "Author" + + click_button "Save" + end + + it "should succeed" do + page.should have_content("was successfully added.") + end + + it "belongs to another user" do + ::Refinery::Blog::Post.last.author.should eq(other_guy) + end + end + end end end -- cgit v1.2.3