2021-06-21 17:08:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class NewProjectReadmeContentExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass
|
|
|
|
TEMPLATE_PATH = Rails.root.join('app', 'experiments', 'templates', 'new_project_readme_content')
|
2021-07-01 17:08:38 -04:00
|
|
|
include Rails.application.routes.url_helpers
|
2021-06-21 17:08:33 -04:00
|
|
|
|
|
|
|
def run_with(project, variant: nil)
|
|
|
|
@project = project
|
|
|
|
record!
|
|
|
|
run(variant)
|
|
|
|
end
|
|
|
|
|
|
|
|
def control_behavior
|
|
|
|
template('readme_basic.md')
|
|
|
|
end
|
|
|
|
|
|
|
|
def advanced_behavior
|
|
|
|
template('readme_advanced.md')
|
|
|
|
end
|
|
|
|
|
2021-07-01 17:08:38 -04:00
|
|
|
def redirect(to_url)
|
2021-07-23 14:10:06 -04:00
|
|
|
experiment_redirect_url(self, url: to_url)
|
2021-07-01 17:08:38 -04:00
|
|
|
end
|
|
|
|
|
2021-06-21 17:08:33 -04:00
|
|
|
private
|
|
|
|
|
|
|
|
def template(name)
|
|
|
|
ERB.new(File.read(TEMPLATE_PATH.join("#{name}.tt")), trim_mode: '<>').result(binding)
|
|
|
|
end
|
|
|
|
end
|