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>2021-02-24 03:11:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-24 03:11:11 +0300
commit97d9d9ee16fd665d9ab0768ee41c4eaa9d2a5e2f (patch)
treee99ea127b6a01b6abacc50e1aede061a79472fc8 /spec
parent5e450e9022861d03048cc733c20585ad0891f5aa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/tracking_spec.js21
-rw-r--r--spec/models/user_spec.rb50
2 files changed, 69 insertions, 2 deletions
diff --git a/spec/frontend/tracking_spec.js b/spec/frontend/tracking_spec.js
index d4dddbe0d82..a9f33b9a069 100644
--- a/spec/frontend/tracking_spec.js
+++ b/spec/frontend/tracking_spec.js
@@ -149,6 +149,27 @@ describe('Tracking', () => {
});
});
+ describe('.flushPendingEvents', () => {
+ it('flushes any pending events', () => {
+ Tracking.initialized = false;
+ Tracking.event('_category_', '_eventName_', { label: '_label_' });
+
+ expect(snowplowSpy).not.toHaveBeenCalled();
+
+ Tracking.flushPendingEvents();
+
+ expect(snowplowSpy).toHaveBeenCalledWith(
+ 'trackStructEvent',
+ '_category_',
+ '_eventName_',
+ '_label_',
+ undefined,
+ undefined,
+ [STANDARD_CONTEXT],
+ );
+ });
+ });
+
describe('tracking interface events', () => {
let eventSpy;
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index bad3c5ef6b5..a84421f6d2c 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1051,7 +1051,7 @@ RSpec.describe User do
let(:user) { create(:user) }
let(:external_user) { create(:user, external: true) }
- it "sets other properties aswell" do
+ it "sets other properties as well" do
expect(external_user.can_create_team).to be_falsey
expect(external_user.can_create_group).to be_falsey
expect(external_user.projects_limit).to be 0
@@ -1062,7 +1062,7 @@ RSpec.describe User do
let(:user) { create(:user) }
let(:secondary) { create(:email, :confirmed, email: 'secondary@example.com', user: user) }
- it 'allows a verfied secondary email to be used as the primary without needing reconfirmation' do
+ it 'allows a verified secondary email to be used as the primary without needing reconfirmation' do
user.update!(email: secondary.email)
user.reload
expect(user.email).to eq secondary.email
@@ -5413,4 +5413,50 @@ RSpec.describe User do
it_behaves_like 'bot user avatars', :support_bot, 'support-bot.png'
it_behaves_like 'bot user avatars', :security_bot, 'security-bot.png'
end
+
+ describe '#confirmation_required_on_sign_in?' do
+ subject { user.confirmation_required_on_sign_in? }
+
+ context 'when user is confirmed' do
+ let(:user) { build_stubbed(:user) }
+
+ it 'is falsey' do
+ expect(user.confirmed?).to be_truthy
+ expect(subject).to be_falsey
+ end
+ end
+
+ context 'when user is not confirmed' do
+ let_it_be(:user) { build_stubbed(:user, :unconfirmed, confirmation_sent_at: Time.current) }
+
+ it 'is truthy when soft_email_confirmation feature is disabled' do
+ stub_feature_flags(soft_email_confirmation: false)
+ expect(subject).to be_truthy
+ end
+
+ context 'when soft_email_confirmation feature is enabled' do
+ before do
+ stub_feature_flags(soft_email_confirmation: true)
+ end
+
+ it 'is falsey when confirmation period is valid' do
+ expect(subject).to be_falsey
+ end
+
+ it 'is truthy when confirmation period is expired' do
+ travel_to(User.allow_unconfirmed_access_for.from_now + 1.day) do
+ expect(subject).to be_truthy
+ end
+ end
+
+ context 'when user has no confirmation email sent' do
+ let(:user) { build(:user, :unconfirmed, confirmation_sent_at: nil) }
+
+ it 'is truthy' do
+ expect(subject).to be_truthy
+ end
+ end
+ end
+ end
+ end
end