aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/blog_posts.rb1
-rw-r--r--spec/models/refinery/blog/category_spec.rb12
2 files changed, 11 insertions, 2 deletions
diff --git a/spec/factories/blog_posts.rb b/spec/factories/blog_posts.rb
index 1ad2bd2..eebad3c 100644
--- a/spec/factories/blog_posts.rb
+++ b/spec/factories/blog_posts.rb
@@ -5,6 +5,7 @@ FactoryGirl.define do
draft false
tag_list "chicago, shopping, fun times"
published_at Time.now
+ author { Factory(:refinery_user) }
factory :blog_post_draft do
draft true
diff --git a/spec/models/refinery/blog/category_spec.rb b/spec/models/refinery/blog/category_spec.rb
index 9c4a7d3..ad83017 100644
--- a/spec/models/refinery/blog/category_spec.rb
+++ b/spec/models/refinery/blog/category_spec.rb
@@ -4,6 +4,7 @@ module Refinery
module Blog
describe Category do
let(:category) { FactoryGirl.create(:blog_category) }
+ let(:refinery_user) { FactoryGirl.create(:refinery_user) }
describe "validations" do
it "requires title" do
@@ -21,8 +22,15 @@ module Refinery
end
it "returns posts by published_at date in descending order" do
- first_post = category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!", :body => "True story.", :published_at => Time.now.yesterday })
- latest_post = category.posts.create!({ :title => "parndt is p. okay", :body => "For a Kiwi.", :published_at => Time.now })
+ first_post = category.posts.create!({ :title => "Breaking News: Joe Sak is hot stuff you guys!!",
+ :body => "True story.",
+ :published_at => Time.now.yesterday,
+ :author => refinery_user })
+
+ latest_post = category.posts.create!({ :title => "parndt is p. okay",
+ :body => "For a Kiwi.",
+ :published_at => Time.now,
+ :author => refinery_user })
category.posts.first.should == latest_post
end