|
|
|
@ -43,6 +43,8 @@ describe 'API v3 Watcher resource', type: :request do |
|
|
|
|
let(:work_package) { FactoryGirl.create(:work_package, project: project) } |
|
|
|
|
let(:available_watcher) { |
|
|
|
|
FactoryGirl.create :user, |
|
|
|
|
firstname: 'Something', |
|
|
|
|
lastname: 'Strange', |
|
|
|
|
member_in_project: project, |
|
|
|
|
member_through_role: view_work_packages_role |
|
|
|
|
} |
|
|
|
@ -228,6 +230,7 @@ describe 'API v3 Watcher resource', type: :request do |
|
|
|
|
let(:available_watchers_path) { api_v3_paths.available_watchers work_package.id } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
available_watcher |
|
|
|
|
get available_watchers_path |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -244,5 +247,23 @@ describe 'API v3 Watcher resource', type: :request do |
|
|
|
|
expect(subject.status).to eql(403) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe 'searching for a user' do |
|
|
|
|
let(:available_watchers_path) { |
|
|
|
|
path = api_v3_paths.available_watchers work_package.id |
|
|
|
|
filters = %([{ "name": { "operator": "~", "values": ["#{query}"] } }]) |
|
|
|
|
"#{path}?filters=#{filters}" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
context 'that does not exist' do |
|
|
|
|
let(:query) { 'asdfasdfasdfasdf' } |
|
|
|
|
it_behaves_like 'API V3 collection response', 0, 0, 'User' |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context 'that does exist' do |
|
|
|
|
let(:query) { 'strange' } |
|
|
|
|
it_behaves_like 'API V3 collection response', 1, 1, 'User' |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|