diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-05-10 20:29:00 -0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-05-16 15:11:55 +0300 |
commit | 3f6121f2f57fab49326a2082a14dae249a91ac9d (patch) | |
tree | af64f4bf66f9e25509a3f76f5a840e72116e5f08 /spec/serializers | |
parent | ca3d868c3731018e18c4b5931d5a37466a16fa6a (diff) | |
download | gitlab-ce-3f6121f2f57fab49326a2082a14dae249a91ac9d.tar.gz |
Returns new_blob_path only when user can push_code to project
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/merge_request_entity_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/serializers/merge_request_entity_spec.rb b/spec/serializers/merge_request_entity_spec.rb index bb6e83ae4bd..b75c73e78c2 100644 --- a/spec/serializers/merge_request_entity_spec.rb +++ b/spec/serializers/merge_request_entity_spec.rb @@ -65,6 +65,23 @@ describe MergeRequestEntity do .to eq(resource.merge_commit_message(include_description: true)) end + describe 'new_blob_path' do + context 'when user can push to project' do + it 'returns path' do + project.add_developer(user) + + expect(subject[:new_blob_path]) + .to eq("/#{resource.project.full_path}/new/#{resource.source_branch}") + end + end + + context 'when user cannot push to project' do + it 'returns nil' do + expect(subject[:new_blob_path]).to be_nil + end + end + end + describe 'diff_head_sha' do before do allow(resource).to receive(:diff_head_sha) { 'sha' } |