diff --git a/Gemfile b/Gemfile index e4901223f95aac61da81df33c295b200b6bf72aa..9b1076baf87090dde15a55ca210b8b48225170b4 100644 --- a/Gemfile +++ b/Gemfile @@ -488,7 +488,7 @@ gem 'flipper', '~> 0.21.0' gem 'flipper-active_record', '~> 0.21.0' gem 'flipper-active_support_cache_store', '~> 0.21.0' gem 'unleash', '~> 3.2.2' -gem 'gitlab-experiment', '~> 0.6.2' +gem 'gitlab-experiment', '~> 0.6.3' # Structured logging gem 'lograge', '~> 0.5' diff --git a/Gemfile.lock b/Gemfile.lock index 38dc22cd5661317d97cade3fce8a006462917481..999bed3eb4d38f0368661331da7a0e42357b75a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -463,7 +463,7 @@ GEM gitlab-dangerfiles (2.3.0) danger (>= 8.3.1) danger-gitlab (>= 8.0.0) - gitlab-experiment (0.6.2) + gitlab-experiment (0.6.3) activesupport (>= 3.0) request_store (>= 1.0) scientist (~> 1.6, >= 1.6.0) @@ -1468,7 +1468,7 @@ DEPENDENCIES github-markup (~> 1.7.0) gitlab-chronic (~> 0.10.5) gitlab-dangerfiles (~> 2.3.0) - gitlab-experiment (~> 0.6.2) + gitlab-experiment (~> 0.6.3) gitlab-fog-azure-rm (~> 1.1.1) gitlab-labkit (~> 0.21.0) gitlab-license (~> 2.0) diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index 4966e508f7e0a1b3f2a5e07c52c211971df310c0..b288d074133aec2f68f700d46048a53e2c1af218 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -236,6 +236,11 @@ expect(subject.process_redirect_url(url)).to be_nil end end + + it "generates the correct urls based on where the engine was mounted" do + url = Rails.application.routes.url_helpers.experiment_redirect_url(subject, url: 'https://docs.gitlab.com') + expect(url).to include("/-/experiment/namespaced%2Fstub:#{subject.context.key}?https://docs.gitlab.com") + end end context "when resolving variants" do diff --git a/spec/experiments/new_project_readme_content_experiment_spec.rb b/spec/experiments/new_project_readme_content_experiment_spec.rb index f76b8a1ded1857a78a7157df619b30365afc88f5..a6a81580a2951dde19fa5e5dfd905da52b5d2c7d 100644 --- a/spec/experiments/new_project_readme_content_experiment_spec.rb +++ b/spec/experiments/new_project_readme_content_experiment_spec.rb @@ -30,9 +30,9 @@ end it "renders redirect URLs" do - expect(markdown).to include( - Rails.application.routes.url_helpers.experiment_redirect_url(subject, url: initial_url) - ) + url = Rails.application.routes.url_helpers.experiment_redirect_url(subject, url: initial_url) + expect(url).to include("/-/experiment/#{subject.to_param}?") + expect(markdown).to include(url) end end end