diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/lib/gitlab/gon_helper_spec.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/lib/gitlab/gon_helper_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gon_helper_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gon_helper_spec.rb b/spec/lib/gitlab/gon_helper_spec.rb index b8ed4cf608d..047873d8237 100644 --- a/spec/lib/gitlab/gon_helper_spec.rb +++ b/spec/lib/gitlab/gon_helper_spec.rb @@ -6,9 +6,41 @@ RSpec.describe Gitlab::GonHelper do let(:helper) do Class.new do include Gitlab::GonHelper + + def current_user + nil + end end.new end + describe '#add_gon_variables' do + let(:gon) { double('gon').as_null_object } + let(:https) { true } + + before do + allow(helper).to receive(:gon).and_return(gon) + stub_config_setting(https: https) + end + + context 'when HTTPS is enabled' do + it 'sets the secure flag to true' do + expect(gon).to receive(:secure=).with(true) + + helper.add_gon_variables + end + end + + context 'when HTTP is enabled' do + let(:https) { false } + + it 'sets the secure flag to false' do + expect(gon).to receive(:secure=).with(false) + + helper.add_gon_variables + end + end + end + describe '#push_frontend_feature_flag' do before do skip_feature_flags_yaml_validation |