Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: test/unit/section_drop_test.rb
- ===================================================================
- --- test/unit/section_drop_test.rb (revision 1907)
- +++ test/unit/section_drop_test.rb (working copy)
- @@ -22,4 +22,16 @@
- assert Mephisto::Liquid::SectionDrop.new(sections(:home)).is_blog
- [:about, :cupcake_home, :cupcake_about].each { |s| assert Mephisto::Liquid::SectionDrop.new(sections(s)).is_paged }
- end
- +
- + # need to adjust fixtures to test these properly.
- + def test_should_return_recent_articles
- + section = Mephisto::Liquid::SectionDrop.new(sections(:home))
- + assert section.recent_articles.size > 0
- + assert section.recent_articles.size <= sections(:home).articles_per_page
- + end
- +
- + def test_should_return_all_articles
- + section = Mephisto::Liquid::SectionDrop.new(sections(:home))
- + assert section.articles.size > 0
- + end
- end
- Index: lib/mephisto/liquid/section_drop.rb
- ===================================================================
- --- lib/mephisto/liquid/section_drop.rb (revision 1907)
- +++ lib/mephisto/liquid/section_drop.rb (working copy)
- @@ -31,6 +31,17 @@
- def is_home
- @source.home?
- end
- +
- + def recent_articles
- + @recent_articles ||= @source.articles.find_by_date(
- + :include => [:user],
- + :limit => @source.articles_per_page,
- + :offset => 0 ).collect(&:to_liquid)
- + end
- +
- + def articles
- + @article ||= @source.articles.find_by_date( :include => [:user] ).collect(&:to_liquid)
- + end
- end
- end
- end
- \ No newline at end of file
Add Comment
Please, Sign In to add comment