Assigned topics are now ordered by topics.bumped_at (#32)

This commit is contained in:
Roman Rizzi 2019-05-07 12:43:47 -03:00 committed by GitHub
parent 578a7f7b70
commit f330120f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -150,6 +150,8 @@ after_initialize do
WHERE name = 'assigned_to_id'
AND value = ?)
", user.id.to_s)
.order("topics.bumped_at DESC")
create_list(:assigned, {}, list)
end

View File

@ -28,6 +28,14 @@ describe TopicQuery do
expect(assigned_messages).to be_empty
end
it 'Returns the results ordered by the bumped_at field' do
@topic.update(bumped_at: 2.weeks.ago)
assigned_messages = TopicQuery.new(user).list_messages_assigned(user).topics
expect(assigned_messages).to eq([@private_message, @topic])
end
end
describe '#list_private_messages_assigned' do