-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2024, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_pbs and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_pbs. | ||
# | ||
require "spec_helper" | ||
|
||
describe SearchStrategies::GroupSearch do | ||
before do | ||
groups(:bund).update!(pbs_shortname: "shortname", description: "description", website: "lemurenshop", | ||
bank_account: "account") | ||
end | ||
|
||
describe "#search_fulltext" do | ||
let(:user) { people(:root) } | ||
|
||
it "finds accessible groups by shortname" do | ||
result = search_class(groups(:bund).pbs_shortname).search_fulltext | ||
expect(result).to include(groups(:bund)) | ||
end | ||
|
||
it "finds accessible groups by description" do | ||
result = search_class(groups(:bund).description).search_fulltext | ||
expect(result).to include(groups(:bund)) | ||
end | ||
|
||
it "finds accessible groups by website" do | ||
result = search_class(groups(:bund).website).search_fulltext | ||
expect(result).to include(groups(:bund)) | ||
end | ||
|
||
it "finds accessible groups by bank account" do | ||
result = search_class(groups(:bund).bank_account).search_fulltext | ||
expect(result).to include(groups(:bund)) | ||
end | ||
end | ||
|
||
def search_class(term = nil, page = nil) | ||
described_class.new(user, term, page) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) 2024, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_pbs and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_pbs. | ||
|
||
require "spec_helper" | ||
|
||
describe SearchStrategies::PersonSearch do | ||
before do | ||
people(:al_schekka).update!(pbs_number: 4566, title: "Sky") | ||
end | ||
|
||
describe "#search_fulltext" do | ||
let(:user) { people(:bulei) } | ||
|
||
it "finds accessible person by title" do | ||
result = search_class(people(:al_schekka).title).search_fulltext | ||
expect(result).to include(people(:al_schekka)) | ||
end | ||
|
||
it "finds accessible person by pbs number" do | ||
result = search_class(people(:al_schekka).pbs_number.to_s).search_fulltext | ||
expect(result).to include(people(:al_schekka)) | ||
end | ||
end | ||
|
||
def search_class(term = nil, page = nil) | ||
described_class.new(user, term, page) | ||
end | ||
end |