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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-10 18:09:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-10 18:09:11 +0300
commitd2091d1e924e2887eb9db4fad761965a24d024f1 (patch)
tree482fe37d97a4169895ae3ddf6d6f42e6f632cbb9 /spec/experiments/application_experiment_spec.rb
parent152b3268d701b54cac9b615a0e29e0e5726bfd99 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/experiments/application_experiment_spec.rb')
-rw-r--r--spec/experiments/application_experiment_spec.rb40
1 files changed, 27 insertions, 13 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb
index 2595512eec3..a0fe9f0f310 100644
--- a/spec/experiments/application_experiment_spec.rb
+++ b/spec/experiments/application_experiment_spec.rb
@@ -64,21 +64,35 @@ RSpec.describe ApplicationExperiment, :experiment do
subject.publish(nil)
end
- it "pushes the experiment knowledge into the client using Gon.global" do
- expect(Gon.global).to receive(:push).with(
- {
- experiment: {
- 'namespaced/stub' => { # string key because it can be namespaced
- experiment: 'namespaced/stub',
- key: '86208ac54ca798e11f127e8b23ec396a',
- variant: 'control'
+ context "when inside a request cycle" do
+ before do
+ subject.context.instance_variable_set(:@request, double('Request', headers: 'true'))
+ end
+
+ it "pushes the experiment knowledge into the client using Gon" do
+ expect(Gon).to receive(:push).with(
+ {
+ experiment: {
+ 'namespaced/stub' => { # string key because it can be namespaced
+ experiment: 'namespaced/stub',
+ key: '86208ac54ca798e11f127e8b23ec396a',
+ variant: 'control'
+ }
}
- }
- },
- true
- )
+ },
+ true
+ )
- subject.publish(nil)
+ subject.publish(nil)
+ end
+ end
+
+ context "when outside a request cycle" do
+ it "does not push to gon when outside request cycle" do
+ expect(Gon).not_to receive(:push)
+
+ subject.publish(nil)
+ end
end
end