diff options
author | Robert Speicher <robert@gitlab.com> | 2017-09-27 22:39:45 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-10-11 17:02:04 +0300 |
commit | 4baea2262bfa7c35df6adf897fed789f69b1e554 (patch) | |
tree | b186a4f1bba520807f1c9291db528a0a3842c232 /spec | |
parent | fa67a9df9f77e84240ec090fb20b815827078f6b (diff) |
Merge branch 'port-ee-3435' into 'security-10-0'
[10.0 CE] Prevent "Related Issues" from leaking confidential issues
See merge request gitlab/gitlabhq!2193
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 19 | ||||
-rw-r--r-- | spec/services/system_note_service_spec.rb | 14 |
2 files changed, 10 insertions, 23 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index b4a22a46b51..e62ac4d4569 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -226,7 +226,7 @@ describe Projects::IssuesController do id: issue.iid, issue: { assignee_ids: [assignee.id] }, format: :json - body = JSON.parse(response.body) + body = json_response expect(body['assignees'].first.keys) .to match_array(%w(id name username avatar_url state web_url)) @@ -889,16 +889,17 @@ describe Projects::IssuesController do describe 'GET #discussions' do let!(:discussion) { create(:discussion_note_on_issue, noteable: issue, project: issue.project) } + context 'when authenticated' do + before do + project.add_developer(user) + sign_in(user) + end - before do - project.add_developer(user) - sign_in(user) - end - - it 'returns discussion json' do - get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid + it 'returns discussion json' do + get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid - expect(JSON.parse(response.body).first.keys).to match_array(%w[id reply_id expanded notes individual_note]) + expect(json_response.first.keys).to match_array(%w[id reply_id expanded notes individual_note]) + end end context 'with cross-reference system note', :request_store do diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index b1241cd8d0b..7129d80284b 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -502,20 +502,6 @@ describe SystemNoteService do end end - describe '.cross_reference?' do - it 'is truthy when text begins with expected text' do - expect(described_class.cross_reference?('mentioned in something')).to be_truthy - end - - it 'is truthy when text begins with legacy capitalized expected text' do - expect(described_class.cross_reference?('mentioned in something')).to be_truthy - end - - it 'is falsey when text does not begin with expected text' do - expect(described_class.cross_reference?('this is a note')).to be_falsey - end - end - describe '.cross_reference_disallowed?' do context 'when mentioner is not a MergeRequest' do it 'is falsey' do |