Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-04 00:09:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-04 00:09:56 +0300
commitc1a50b8195f4e36fda9b233acbde57a449bcf6c3 (patch)
treeb24a10a7951e9a799397753d1badf6894fe03089 /spec/views
parentb6847c621ff246e6abceb90545d5a608318762d6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/profiles/show.html.haml_spec.rb44
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