diff options
author | Pete Higgins <pete@peterhiggins.org> | 2012-02-10 00:38:21 -0800 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2012-02-10 01:06:05 -0800 |
commit | aaf26e22d2feb03ebf4126e88406209239631a67 (patch) | |
tree | 600beb552164cd5c858fa57cba54dc9e838075fe /spec/models | |
parent | 80187eac7d35a9a5ac67019a317e678c4445e44e (diff) | |
download | refinerycms-blog-aaf26e22d2feb03ebf4126e88406209239631a67.tar.gz refinerycms-blog-aaf26e22d2feb03ebf4126e88406209239631a67.tar.bz2 refinerycms-blog-aaf26e22d2feb03ebf4126e88406209239631a67.zip |
Refactor all_previous into published_dates_older_than.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/refinery/blog/post_spec.rb | 11 |
1 files changed, 6 insertions, 5 deletions
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 |