diff options
Diffstat (limited to 'spec/views/profiles/show.html.haml_spec.rb')
-rw-r--r-- | spec/views/profiles/show.html.haml_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb index 14e6feed3ab..e1c21f87780 100644 --- a/spec/views/profiles/show.html.haml_spec.rb +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -19,4 +19,48 @@ describe 'profiles/show' do expect(rendered).to have_field('user_id', with: user.id) end end + + context 'gitlab.com organization field' do + before do + allow(Gitlab).to receive(:com?).and_return(true) + end + + context 'when `:gitlab_employee_badge` feature flag is enabled' do + context 'and when user has an `@gitlab.com` email address' do + let(:user) { create(:user, email: 'test@gitlab.com') } + + it 'displays the organization field as `readonly` with a `value` of `GitLab`' do + render + + expect(rendered).to have_selector('#user_organization[readonly][value="GitLab"]') + end + end + + context 'and when a user does not have an `@gitlab.com` email' do + let(:user) { create(:user, email: 'test@example.com') } + + it 'displays an editable organization field' do + render + + expect(rendered).to have_selector('#user_organization:not([readonly]):not([value="GitLab"])') + end + end + end + + context 'when `:gitlab_employee_badge` feature flag is disabled' do + before do + stub_feature_flags(gitlab_employee_badge: false) + end + + context 'and when a user has an `@gitlab.com` email' do + let(:user) { create(:user, email: 'test@gitlab.com') } + + it 'displays an editable organization field' do + render + + expect(rendered).to have_selector('#user_organization:not([readonly]):not([value="GitLab"])') + end + end + end + end end |