diff options
Diffstat (limited to 'spec/models/refinery/blog/post_spec.rb')
-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 |