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/sessions_helper_spec.rb')
-rw-r--r--spec/helpers/sessions_helper_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/helpers/sessions_helper_spec.rb b/spec/helpers/sessions_helper_spec.rb
index 027943aecee..816e43669bd 100644
--- a/spec/helpers/sessions_helper_spec.rb
+++ b/spec/helpers/sessions_helper_spec.rb
@@ -3,6 +3,42 @@
require 'spec_helper'
RSpec.describe SessionsHelper do
+ describe '#recently_confirmed_com?' do
+ subject { helper.recently_confirmed_com? }
+
+ context 'when on .com' do
+ before do
+ allow(Gitlab).to receive(:dev_env_or_com?).and_return(true)
+ end
+
+ it 'when flash notice is empty it is false' do
+ flash[:notice] = nil
+ expect(subject).to be false
+ end
+
+ it 'when flash notice is anything it is false' do
+ flash[:notice] = 'hooray!'
+ expect(subject).to be false
+ end
+
+ it 'when flash notice is devise confirmed message it is true' do
+ flash[:notice] = t(:confirmed, scope: [:devise, :confirmations])
+ expect(subject).to be true
+ end
+ end
+
+ context 'when not on .com' do
+ before do
+ allow(Gitlab).to receive(:dev_env_or_com?).and_return(false)
+ end
+
+ it 'when flash notice is devise confirmed message it is false' do
+ flash[:notice] = t(:confirmed, scope: [:devise, :confirmations])
+ expect(subject).to be false
+ end
+ end
+ end
+
describe '#unconfirmed_email?' do
it 'returns true when the flash alert contains a devise failure unconfirmed message' do
flash[:alert] = t(:unconfirmed, scope: [:devise, :failure])