search for: group_terms

Displaying 1 result from an estimated 1 matches for "group_terms".

2008 Apr 22
0
rspec model class methods
...lose. I recently realized the need to add the method below grouped_by_months and started to write a spec. idea 1: {{{ before do @comment = Comment.new @comment.stub!(:created_at).and_return(Time.now -2.days) end it ''should return comments grouped by month'' do group_terms = lambda{|comment| comment.created_at.beginning_of_month } Comment.should_receive(:find).and_return([@comment]) [@comment].should_receive(:group_by).with(&group_terms).and_return([[@comment]]) Comment.grouped_by_month end }}} idea 2 {{{ before do @comment = Comment.new...