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/helpers/users_helper_spec.rb')
-rw-r--r--spec/helpers/users_helper_spec.rb43
1 files changed, 39 insertions, 4 deletions
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
index f26c37a5ff2..6ee208dfd15 100644
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -497,17 +497,20 @@ RSpec.describe UsersHelper do
describe '#user_profile_tabs_app_data' do
before do
allow(helper).to receive(:user_calendar_path).with(user, :json).and_return('/users/root/calendar.json')
+ allow(helper).to receive(:user_activity_path).with(user, :json).and_return('/users/root/activity.json')
allow(user).to receive_message_chain(:followers, :count).and_return(2)
allow(user).to receive_message_chain(:followees, :count).and_return(3)
end
it 'returns expected hash' do
- expect(helper.user_profile_tabs_app_data(user)).to eq({
- followees: 3,
- followers: 2,
+ expect(helper.user_profile_tabs_app_data(user)).to match({
+ followees_count: 3,
+ followers_count: 2,
user_calendar_path: '/users/root/calendar.json',
+ user_activity_path: '/users/root/activity.json',
utc_offset: 0,
- user_id: user.id
+ user_id: user.id,
+ snippets_empty_state: match_asset_path('illustrations/empty-state/empty-snippets-md.svg')
})
end
end
@@ -561,4 +564,36 @@ RSpec.describe UsersHelper do
end
end
end
+
+ describe '#moderation_status', feature_category: :instance_resiliency do
+ let(:user) { create(:user) }
+
+ subject { moderation_status(user) }
+
+ context 'when user is nil' do
+ let(:user) { nil }
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'when a user is banned' do
+ before do
+ user.ban!
+ end
+
+ it { is_expected.to eq('Banned') }
+ end
+
+ context 'when a user is blocked' do
+ before do
+ user.block!
+ end
+
+ it { is_expected.to eq('Blocked') }
+ end
+
+ context 'when a user is active' do
+ it { is_expected.to eq('Active') }
+ end
+ end
end