diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/autocomplete_controller_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 1230017c270..3521d690259 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -4,6 +4,7 @@ describe AutocompleteController do let!(:project) { create(:project) } let!(:user) { create(:user) } let!(:user2) { create(:user) } + let!(:non_member) { create(:user) } context 'project members' do before do @@ -61,6 +62,27 @@ describe AutocompleteController do end end + context 'non-member login for public project' do + let!(:project) { create(:project, :public) } + + before do + sign_in(non_member) + project.team << [user, :master] + end + + let(:body) { JSON.parse(response.body) } + + describe 'GET #users with project ID' do + before do + get(:users, project_id: project.id) + end + + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq 2 } + it { expect(body.map { |u| u['username'] }).to match_array([user.username, non_member.username]) } + end + end + context 'all users' do before do sign_in(user) |