Commit 652f71f7 authored by Etienne Baqué's avatar Etienne Baqué

Updated MR based on review comments

parent 969f62a8
...@@ -8,7 +8,7 @@ class BilledUsersFinder ...@@ -8,7 +8,7 @@ class BilledUsersFinder
end end
def execute def execute
return [] unless group_billed_user_ids.any? return User.none unless group_billed_user_ids.any?
users = ::User.id_in(group_billed_user_ids) users = ::User.id_in(group_billed_user_ids)
users = users.search(search_term) if search_term users = users.search(search_term) if search_term
......
...@@ -33,6 +33,14 @@ RSpec.describe BilledUsersFinder do ...@@ -33,6 +33,14 @@ RSpec.describe BilledUsersFinder do
expect(subject.execute).to eq([john_smith, john_doe].map(&:user)) expect(subject.execute).to eq([john_smith, john_doe].map(&:user))
end end
end end
context 'when a sorting parameter is not provided' do
subject { described_class.new(group, search_term: search_term) }
it 'sorts expected results in name_asc order' do
expect(subject.execute).to eq([john_doe, john_smith].map(&:user))
end
end
end end
context 'when a search parameter is not present' do context 'when a search parameter is not present' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment