diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-04 12:10:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-04 12:10:04 +0000 |
commit | 998adcc422d4161515bf2960ef4dce71258f69a3 (patch) | |
tree | 34ffbf53b8587d3367457d4175fc8dfd71477dca /spec/helpers/auth_helper_spec.rb | |
parent | e2c471038ab2b4f09487c1feb74520f74f834986 (diff) | |
download | gitlab-ce-998adcc422d4161515bf2960ef4dce71258f69a3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/auth_helper_spec.rb')
-rw-r--r-- | spec/helpers/auth_helper_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb index beffa4cf60e..5194285b965 100644 --- a/spec/helpers/auth_helper_spec.rb +++ b/spec/helpers/auth_helper_spec.rb @@ -313,4 +313,37 @@ RSpec.describe AuthHelper do it { is_expected.to be_falsey } end end + + describe '#auth_app_owner_text' do + shared_examples 'generates text with the correct info' do + it 'includes the name of the application owner' do + auth_app_owner_text = helper.auth_app_owner_text(owner) + + expect(auth_app_owner_text).to include(owner.name) + expect(auth_app_owner_text).to include(path_to_owner) + end + end + + context 'when owner is a user' do + let_it_be(:owner) { create(:user) } + + let(:path_to_owner) { user_path(owner) } + + it_behaves_like 'generates text with the correct info' + end + + context 'when owner is a group' do + let_it_be(:owner) { create(:group) } + + let(:path_to_owner) { user_path(owner) } + + it_behaves_like 'generates text with the correct info' + end + + context 'when the user is missing' do + it 'returns nil' do + expect(helper.auth_app_owner_text(nil)).to be(nil) + end + end + end end |