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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-15 09:12:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-15 09:12:51 +0300
commit9a0e0265e4fd6ef93e63c670adc66637dd6ff553 (patch)
treecccf72d3e3081367a39d224ba71a111bea5f9604 /spec
parent6eb95ccbe88e8e8db374079895549cf8c3f50a1c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/fast_spec_helper.rb7
-rw-r--r--spec/frontend/vue_shared/components/user_popover/user_popover_spec.js39
-rw-r--r--spec/spec_helper.rb6
-rw-r--r--spec/support/rspec.rb7
4 files changed, 42 insertions, 17 deletions
diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb
index 722c1e66f34..db4d9125e6e 100644
--- a/spec/fast_spec_helper.rb
+++ b/spec/fast_spec_helper.rb
@@ -32,13 +32,6 @@ end
ActiveSupport::XmlMini.backend = 'Nokogiri'
RSpec.configure do |config|
- unless ENV['CI']
- # Allow running `:focus` examples locally,
- # falling back to all tests when there is no `:focus` example.
- config.filter_run focus: true
- config.run_all_when_everything_filtered = true
- end
-
# Makes diffs show entire non-truncated values.
config.before(:each, unlimited_max_formatted_output_length: true) do |_example|
config.expect_with :rspec do |c|
diff --git a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
index ce9b7c5f061..6d48000beb0 100644
--- a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
+++ b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
@@ -1,8 +1,15 @@
import { GlSkeletonLoader, GlIcon } from '@gitlab/ui';
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
+import { sprintf } from '~/locale';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { AVAILABILITY_STATUS } from '~/set_status_modal/constants';
import UserPopover from '~/vue_shared/components/user_popover/user_popover.vue';
+import {
+ I18N_USER_BLOCKED,
+ I18N_USER_LEARN,
+ I18N_USER_FOLLOW,
+ I18N_USER_UNFOLLOW,
+} from '~/vue_shared/components/user_popover/constants';
import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash';
import { followUser, unfollowUser } from '~/api/user_api';
@@ -310,7 +317,9 @@ describe('User Popover Component', () => {
const securityBotDocsLink = findSecurityBotDocsLink();
expect(securityBotDocsLink.exists()).toBe(true);
expect(securityBotDocsLink.attributes('href')).toBe(SECURITY_BOT_USER.websiteUrl);
- expect(securityBotDocsLink.text()).toBe('Learn more about GitLab Security Bot');
+ expect(securityBotDocsLink.text()).toBe(
+ sprintf(I18N_USER_LEARN, { name: SECURITY_BOT_USER.name }),
+ );
});
it("does not show a link to the bot's documentation if there is no website_url", () => {
@@ -320,9 +329,10 @@ describe('User Popover Component', () => {
});
it("doesn't escape user's name", () => {
- createWrapper({ user: { ...SECURITY_BOT_USER, name: '%<>\';"' } });
+ const name = '%<>\';"';
+ createWrapper({ user: { ...SECURITY_BOT_USER, name } });
const securityBotDocsLink = findSecurityBotDocsLink();
- expect(securityBotDocsLink.text()).toBe('Learn more about %<>\';"');
+ expect(securityBotDocsLink.text()).toBe(sprintf(I18N_USER_LEARN, { name }, false));
});
it('does not display local time', () => {
@@ -336,7 +346,7 @@ describe('User Popover Component', () => {
beforeEach(() => createWrapper());
it('renders the Follow button with the correct variant', () => {
- expect(findToggleFollowButton().text()).toBe('Follow');
+ expect(findToggleFollowButton().text()).toBe(I18N_USER_FOLLOW);
expect(findToggleFollowButton().props('variant')).toBe('confirm');
});
@@ -387,7 +397,7 @@ describe('User Popover Component', () => {
beforeEach(() => createWrapper({ user: { ...DEFAULT_PROPS.user, isFollowed: true } }));
it('renders the Unfollow button with the correct variant', () => {
- expect(findToggleFollowButton().text()).toBe('Unfollow');
+ expect(findToggleFollowButton().text()).toBe(I18N_USER_UNFOLLOW);
expect(findToggleFollowButton().props('variant')).toBe('default');
});
@@ -441,6 +451,25 @@ describe('User Popover Component', () => {
});
});
+ describe('when the user is blocked', () => {
+ const bio = 'My super interesting bio';
+ const status = 'My status';
+ beforeEach(() =>
+ createWrapper({
+ user: { ...DEFAULT_PROPS.user, state: 'blocked', bio, status: { message_html: status } },
+ }),
+ );
+
+ it('renders warning', () => {
+ expect(wrapper.text()).toContain(I18N_USER_BLOCKED);
+ });
+
+ it("doesn't show other information", () => {
+ expect(wrapper.text()).not.toContain(bio);
+ expect(wrapper.text()).not.toContain(status);
+ });
+ });
+
describe('when API does not support `isFollowed`', () => {
beforeEach(() => {
const user = {
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 18820eefe31..a40f19ecf7c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -36,6 +36,7 @@ require 'rspec-parameterized'
require 'shoulda/matchers'
require 'test_prof/recipes/rspec/let_it_be'
require 'test_prof/factory_default'
+require 'test_prof/factory_prof/nate_heckler'
require 'parslet/rig/rspec'
rspec_profiling_is_configured =
@@ -109,11 +110,6 @@ RSpec.configure do |config|
warn `curl -s -o log/goroutines.log http://localhost:9236/debug/pprof/goroutine?debug=2`
end
end
- else
- # Allow running `:focus` examples locally,
- # falling back to all tests when there is no `:focus` example.
- config.filter_run focus: true
- config.run_all_when_everything_filtered = true
end
# Attempt to troubleshoot https://gitlab.com/gitlab-org/gitlab/-/issues/351531
diff --git a/spec/support/rspec.rb b/spec/support/rspec.rb
index 2d37501f7c6..6795d2f6d2a 100644
--- a/spec/support/rspec.rb
+++ b/spec/support/rspec.rb
@@ -14,6 +14,13 @@ RSpec.configure do |config|
# Re-run failures locally with `--only-failures`
config.example_status_persistence_file_path = ENV.fetch('RSPEC_LAST_RUN_RESULTS_FILE', './spec/examples.txt')
+ unless ENV['CI']
+ # Allow running `:focus` examples locally,
+ # falling back to all tests when there is no `:focus` example.
+ config.filter_run focus: true
+ config.run_all_when_everything_filtered = true
+ end
+
config.mock_with :rspec do |mocks|
mocks.verify_doubled_constant_names = true
end