summaryrefslogtreecommitdiff
path: root/spec/lib/bitbucket_server/representation/comment_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/bitbucket_server/representation/comment_spec.rb')
-rw-r--r--spec/lib/bitbucket_server/representation/comment_spec.rb25
1 files changed, 24 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