diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-10 21:12:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-10 21:12:35 +0300 |
commit | 6fd750c19206412cfc52b49a70b56147d839c52f (patch) | |
tree | 04607e6c9864c09dd312d6bfc3efe9cc5f81c762 /spec/views/layouts | |
parent | 26881dd926cfac47c9603d44e8d5a504ab8c4a14 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/layouts')
-rw-r--r-- | spec/views/layouts/_published_experiments.html.haml_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/views/layouts/_published_experiments.html.haml_spec.rb b/spec/views/layouts/_published_experiments.html.haml_spec.rb new file mode 100644 index 00000000000..d1ade8ddd6e --- /dev/null +++ b/spec/views/layouts/_published_experiments.html.haml_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/_published_experiments', :experiment do + before do + stub_const('TestControlExperiment', ApplicationExperiment) + stub_const('TestCandidateExperiment', ApplicationExperiment) + stub_const('TestExcludedExperiment', ApplicationExperiment) + + TestControlExperiment.new('test_control').tap do |e| + e.variant(:control) + e.publish + end + TestCandidateExperiment.new('test_candidate').tap do |e| + e.variant(:candidate) + e.publish + end + TestExcludedExperiment.new('test_excluded').tap do |e| + e.exclude! + e.publish + end + + render + end + + it 'renders out data for all non-excluded, published experiments' do + output = rendered + + expect(output).to include('gl.experiments = {') + expect(output).to match(/"test_control":\{[^}]*"variant":"control"/) + expect(output).to match(/"test_candidate":\{[^}]*"variant":"candidate"/) + expect(output).not_to include('"test_excluded"') + end +end |