fix regression from #3968
Not ordering the IDs caused incorret ones returned The spec is totally at the wrong level but I couldn't make something up that exposed the bug at a deeper level :(
This commit is contained in:
parent
4dd1c728e5
commit
ddfc558a9b
2 changed files with 22 additions and 2 deletions
|
|
@ -139,11 +139,11 @@ module EvilQuery
|
|||
end
|
||||
|
||||
def persons_private_visibilities
|
||||
contact.share_visibilities.where(:hidden => false, :shareable_type => @class.to_s).limit(15)
|
||||
contact.share_visibilities.where(:hidden => false, :shareable_type => @class.to_s).order("created_at DESC").limit(15)
|
||||
end
|
||||
|
||||
def persons_public_posts
|
||||
@person.send(table_name).where(:public => true).select(table_name + '.id').limit(15)
|
||||
@person.send(table_name).where(:public => true).select(table_name + '.id').order("created_at DESC").limit(15)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,4 +9,24 @@ describe Stream::Person do
|
|||
describe 'shared behaviors' do
|
||||
it_should_behave_like 'it is a stream'
|
||||
end
|
||||
|
||||
it "returns the most recent posts" do
|
||||
posts = []
|
||||
fetched_posts = []
|
||||
|
||||
aspect = bob.aspects.first.id
|
||||
Timecop.scale(600) do
|
||||
16.times do |n|
|
||||
posts << bob.post(:status_message, text: "hello#{n}", to: aspect)
|
||||
posts << bob.post(:status_message, text: "hello#{n}", public: true)
|
||||
end
|
||||
|
||||
fetched_posts = Stream::Person.new(alice, bob.person).stream_posts
|
||||
end
|
||||
|
||||
posts = posts.reverse.slice(0..14)
|
||||
fetched_posts = fetched_posts.slice(0..14)
|
||||
|
||||
fetched_posts.should == posts
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue