diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-09 10:33:42 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-09 10:33:42 +0300 |
commit | d39871d080ffbba35f4e58ed6c13c684e01be773 (patch) | |
tree | b70047104b288e44713e98ac688ef7643a0df8e2 | |
parent | 60a1e843faacb570b3480e12cf67424d79840ebb (diff) |
Rename search_invited to search_invite_email
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 2 | ||||
-rw-r--r-- | app/models/member.rb | 2 | ||||
-rw-r--r-- | spec/models/member_spec.rb | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index fc5cb3f0b5c..557888711ec 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -29,7 +29,7 @@ class Groups::GroupMembersController < Groups::ApplicationController 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 diff --git a/app/models/member.rb b/app/models/member.rb index ada779f0583..dbae1076670 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -107,7 +107,7 @@ class Member < ApplicationRecord joins(:user).merge(User.search(query)) end - def search_invited(query) + def search_invite_email(query) invite.where(['invite_email ILIKE ?', "%#{query}%"]) end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 99b268b07e8..25c39a1062c 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -172,14 +172,16 @@ describe Member do 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 |