diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2016-04-15 15:43:26 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2016-04-15 15:43:26 +0000 |
commit | bb59a1f98eb44cbe288d876eb963e9467b8637f4 (patch) | |
tree | 0c0ad27bc8781a853ced8382265efd19669f6930 /spec/controllers | |
parent | 8b7bf2a0e0fb4ec5765f0b1da74a121a82659113 (diff) | |
parent | 33f8b06c3925fbefd6eac38efc71eac8b787ebd7 (diff) | |
download | gitlab-ce-bb59a1f98eb44cbe288d876eb963e9467b8637f4.tar.gz |
Merge branch 'assign-to-issuable-opener' into 'master'
Issuable can be assigned to author
Closes #9014
The only difference with #9014 is that I thoughed the author should also be
able to assign the issue. If this is unwanted behavior Ill revert it.
/cc @DouweM
See merge request !2765
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/autocomplete_controller_spec.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 410b993fdfb..28cf804c1b2 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -12,13 +12,13 @@ describe AutocompleteController do 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 + let(:body) { JSON.parse(response.body) } + it { expect(body).to be_kind_of(Array) } it { expect(body.size).to eq 1 } it { expect(body.map { |u| u["username"] }).to include(user.username) } @@ -143,4 +143,24 @@ describe AutocompleteController do it { expect(body.size).to eq 0 } end end + + context 'author of issuable included' do + before do + sign_in(user) + end + + let(:body) { JSON.parse(response.body) } + + it 'includes the author' do + get(:users, author_id: non_member.id) + + expect(body.first["username"]).to eq non_member.username + end + + it 'rejects non existent user ids' do + get(:users, author_id: 99999) + + expect(body.collect { |u| u['id'] }).not_to include(99999) + end + end end |