diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/lib/bitbucket_server | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/lib/bitbucket_server')
-rw-r--r-- | spec/lib/bitbucket_server/representation/comment_spec.rb | 25 | ||||
-rw-r--r-- | spec/lib/bitbucket_server/representation/pull_request_spec.rb | 27 |
2 files changed, 51 insertions, 1 deletions
diff --git a/spec/lib/bitbucket_server/representation/comment_spec.rb b/spec/lib/bitbucket_server/representation/comment_spec.rb index b568789bd97..41cdaab7a00 100644 --- a/spec/lib/bitbucket_server/representation/comment_spec.rb +++ b/spec/lib/bitbucket_server/representation/comment_spec.rb @@ -13,7 +13,30 @@ RSpec.describe BitbucketServer::Representation::Comment do end describe '#author_username' do - it { expect(subject.author_username).to eq('root' ) } + it 'returns username' do + expect(subject.author_username).to eq('username') + end + + context 'when username is absent' do + before do + comment['comment']['author'].delete('username') + end + + it 'returns slug' do + expect(subject.author_username).to eq('slug') + end + end + + context 'when slug and username are absent' do + before do + comment['comment']['author'].delete('username') + comment['comment']['author'].delete('slug') + end + + it 'returns displayName' do + expect(subject.author_username).to eq('root') + end + end end describe '#author_email' do diff --git a/spec/lib/bitbucket_server/representation/pull_request_spec.rb b/spec/lib/bitbucket_server/representation/pull_request_spec.rb index a05d98f0d4a..d7b893e8081 100644 --- a/spec/lib/bitbucket_server/representation/pull_request_spec.rb +++ b/spec/lib/bitbucket_server/representation/pull_request_spec.rb @@ -15,6 +15,33 @@ RSpec.describe BitbucketServer::Representation::PullRequest do it { expect(subject.author_email).to eq('joe.montana@49ers.com') } end + describe '#author_username' do + it 'returns username' do + expect(subject.author_username).to eq('username') + end + + context 'when username is absent' do + before do + sample_data['author']['user'].delete('username') + end + + it 'returns slug' do + expect(subject.author_username).to eq('slug') + end + end + + context 'when slug and username are absent' do + before do + sample_data['author']['user'].delete('username') + sample_data['author']['user'].delete('slug') + end + + it 'returns displayName' do + expect(subject.author_username).to eq('displayName') + end + end + end + describe '#description' do it { expect(subject.description).to eq('Test') } end |