Commit 48da9ab4 authored by Stan Hu's avatar Stan Hu
Browse files

Rename search_invited to search_invite_email

parent 3cc74bf9a885
......@@ -29,7 +29,7 @@ def index
if can_manage_members
@invited_members = @members.invite
@invited_members = @invited_members.search_invited(params[:search_invited]) if params[:search_invited].present?
@invited_members = @invited_members.search_invite_email(params[:search_invited]) if params[:search_invited].present?
@invited_members = present_members(@invited_members.page(params[:invited_members_page]).per(MEMBER_PER_PAGE_LIMIT))
end
......
......@@ -107,7 +107,7 @@ def search(query)
joins(:user).merge(User.search(query))
end
def search_invited(query)
def search_invite_email(query)
invite.where(['invite_email ILIKE ?', "%#{query}%"])
end
......
......@@ -172,14 +172,16 @@
it { expect(described_class.non_request).to include @accepted_request_member }
end
describe '.search_invited' do
describe '.search_invite_email' do
it 'returns only the matching e-mail' do
create(:group_member, :invited)
invited = described_class.search_invited(@invited_member.invite_email)
invited = described_class.search_invite_email(@invited_member.invite_email)
expect(invited.count).to eq(1)
expect(invited.first).to eq(@invited_member)
expect(described_class.search_invite_email('bad-email@example.com').count).to eq(0)
end
end
......
Supports Markdown
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