From aaf26e22d2feb03ebf4126e88406209239631a67 Mon Sep 17 00:00:00 2001 From: Pete Higgins Date: Fri, 10 Feb 2012 00:38:21 -0800 Subject: Refactor all_previous into published_dates_older_than. --- spec/models/refinery/blog/post_spec.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'spec') diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb index 1d0a3e7..1e7ec5a 100644 --- a/spec/models/refinery/blog/post_spec.rb +++ b/spec/models/refinery/blog/post_spec.rb @@ -70,16 +70,17 @@ module Refinery end end - describe "all_previous scope" do + describe ".published_dates_older_than" do before do @post1 = FactoryGirl.create(:blog_post, :published_at => Time.now - 2.months) @post2 = FactoryGirl.create(:blog_post, :published_at => Time.now - 1.month) FactoryGirl.create(:blog_post, :published_at => Time.now) end - it "returns all posts from previous months" do - subject.class.all_previous.count.should be == 2 - subject.class.all_previous.should == [@post2, @post1] + it "returns all published dates older than the argument" do + expected = [@post2.published_at, @post1.published_at] + + described_class.published_dates_older_than(1.day.ago).should eq(expected) end end @@ -246,4 +247,4 @@ module Refinery end end -end \ No newline at end of file +end -- cgit v1.2.3