2021-09-30 23:02:18 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class NewProjectReadmeContentExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass
|
|
|
|
TEMPLATE_PATH = Rails.root.join('app', 'experiments', 'templates', 'new_project_readme_content')
|
|
|
|
include Rails.application.routes.url_helpers
|
|
|
|
|
|
|
|
def run_with(project, variant: nil)
|
|
|
|
@project = project
|
2022-01-26 12:08:38 +05:30
|
|
|
publish_to_database
|
2021-09-30 23:02:18 +05:30
|
|
|
run(variant)
|
|
|
|
end
|
|
|
|
|
|
|
|
def control_behavior
|
|
|
|
template('readme_basic.md')
|
|
|
|
end
|
|
|
|
|
|
|
|
def advanced_behavior
|
|
|
|
template('readme_advanced.md')
|
|
|
|
end
|
|
|
|
|
|
|
|
def redirect(to_url)
|
2021-10-27 15:23:28 +05:30
|
|
|
experiment_redirect_url(self, url: to_url)
|
2021-09-30 23:02:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def template(name)
|
|
|
|
ERB.new(File.read(TEMPLATE_PATH.join("#{name}.tt")), trim_mode: '<>').result(binding)
|
|
|
|
end
|
|
|
|
end
|