aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2012-02-10 00:38:21 -0800
committerPete Higgins <pete@peterhiggins.org>2012-02-10 01:06:05 -0800
commitaaf26e22d2feb03ebf4126e88406209239631a67 (patch)
tree600beb552164cd5c858fa57cba54dc9e838075fe /spec
parent80187eac7d35a9a5ac67019a317e678c4445e44e (diff)
downloadrefinerycms-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')
-rw-r--r--spec/models/refinery/blog/post_spec.rb11
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