Skip to content
代码片段 群组 项目
提交 91d30467 编辑于 作者: Marco Zille's avatar Marco Zille
浏览文件

Applied suggestions from review

上级 14b2079b
No related branches found
No related tags found
无相关合并请求
......@@ -101,18 +101,18 @@
context 'when search term is empty' do
it 'returns all group contacts alphabetically ordered' do
finder = described_class.new(user, group: search_test_group, search: "")
expect(finder.execute).to match_array([search_test_a, search_test_b])
expect(finder.execute).to eq([search_test_a, search_test_b])
end
end
context 'when search term is not empty' do
it 'searches for first name' do
finder = described_class.new(user, group: search_test_group, search: "abc")
it 'searches for first name ignoring casing' do
finder = described_class.new(user, group: search_test_group, search: "aBc")
expect(finder.execute).to match_array([search_test_a])
end
it 'searches for last name' do
finder = described_class.new(user, group: search_test_group, search: "STU")
it 'searches for last name ignoring casing' do
finder = described_class.new(user, group: search_test_group, search: "StU")
expect(finder.execute).to match_array([search_test_b])
end
......@@ -121,10 +121,15 @@
expect(finder.execute).to match_array([search_test_a])
end
it 'searches for description' do
finder = described_class.new(user, group: search_test_group, search: "YZ")
it 'searches for description ignoring casing' do
finder = described_class.new(user, group: search_test_group, search: "Yz")
expect(finder.execute).to match_array([search_test_b])
end
it 'fuzzy searches for email and last name' do
finder = described_class.new(user, group: search_test_group, search: "s")
expect(finder.execute).to match_array([search_test_a, search_test_b])
end
end
context 'when searching for contacts state' do
......
......@@ -95,7 +95,7 @@
context 'when search term is empty' do
it 'returns all group organizations alphabetically ordered' do
finder = described_class.new(user, group: search_test_group, search: "")
expect(finder.execute).to match_array([search_test_b, search_test_a])
expect(finder.execute).to eq([search_test_b, search_test_a])
end
end
......
......@@ -34,16 +34,18 @@
describe '#resolve' do
context 'with unauthorized user' do
it 'returns no contacts' do
it 'does not rise an error and returns no contacts' do
expect { resolve_contacts(group) }.not_to raise_error
expect(resolve_contacts(group)).to be_empty
end
end
context 'with authorized user' do
it 'returns no contacts' do
group.add_guest(user)
it 'does not rise an error and returns all contacts' do
group.add_reporter(user)
expect { resolve_contacts(group) }.not_to raise_error
expect(resolve_contacts(group)).to eq([contact_a, contact_b])
end
end
......
......@@ -28,16 +28,18 @@
describe '#resolve' do
context 'with unauthorized user' do
it 'returns no organizations' do
it 'does not rise an error and returns no organizations' do
expect { resolve_organizations(group) }.not_to raise_error
expect(resolve_organizations(group)).to be_empty
end
end
context 'with authorized user' do
it 'returns no organizations' do
group.add_guest(user)
it 'does not rise an error and returns all organizations' do
group.add_reporter(user)
expect { resolve_organizations(group) }.not_to raise_error
expect(resolve_organizations(group)).to eq([organization_a, organization_b])
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册