assert that prep_opts works; reference BaseStream types in lieu of subclassed AspectStream's

This commit is contained in:
Ilya Zhitomirskiy 2011-10-06 17:26:29 -07:00
parent 7572eaaf0d
commit 018a42b001
2 changed files with 17 additions and 1 deletions

View file

@ -126,7 +126,7 @@ module Diaspora
# @return [Hash]
def prep_opts(opts)
defaults = {
:type => AspectStream::TYPES_OF_POST_IN_STREAM,
:type => BaseStream::TYPES_OF_POST_IN_STREAM,
:order => 'created_at DESC',
:limit => 15,
:hidden => false

View file

@ -140,6 +140,22 @@ describe User do
end
end
describe "#prep_opts" do
it "defaults the opts" do
time = Time.now
Time.stub(:now).and_return(time)
alice.send(:prep_opts, {}).should == {
:type => BaseStream::TYPES_OF_POST_IN_STREAM,
:order => 'created_at DESC',
:limit => 15,
:hidden => false,
:order_field => :created_at,
:order_with_table => "posts.created_at DESC",
:max_time => time + 1
}
end
end
describe "#visible_posts" do
context 'with many posts' do
before do