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:
Diffstat (limited to 'spec/views/admin/users/_user.html.haml_spec.rb')
-rw-r--r--spec/views/admin/users/_user.html.haml_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/views/admin/users/_user.html.haml_spec.rb b/spec/views/admin/users/_user.html.haml_spec.rb
new file mode 100644
index 00000000000..96d84229d94
--- /dev/null
+++ b/spec/views/admin/users/_user.html.haml_spec.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'admin/users/_user.html.haml' do
+ before do
+ allow(view).to receive(:user).and_return(user)
+ end
+
+ context 'internal users' do
+ context 'when showing a `Ghost User`' do
+ let(:user) { create(:user, ghost: true) }
+
+ it 'does not render action buttons' do
+ render
+
+ expect(rendered).not_to have_selector('.table-action-buttons')
+ end
+ end
+
+ context 'when showing a `Bot User`' do
+ let(:user) { create(:user, user_type: :alert_bot) }
+
+ it 'does not render action buttons' do
+ render
+
+ expect(rendered).not_to have_selector('.table-action-buttons')
+ end
+ end
+ end
+
+ context 'when showing an external user' do
+ let(:user) { create(:user) }
+
+ it 'renders action buttons' do
+ render
+
+ expect(rendered).to have_selector('.table-action-buttons')
+ end
+ end
+end