debian-mirror-gitlab/spec/experiments/new_project_readme_content_experiment_spec.rb

39 lines
1.1 KiB
Ruby
Raw Normal View History

2021-09-30 23:02:18 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe NewProjectReadmeContentExperiment, :experiment do
subject { described_class.new(namespace: project.namespace) }
let(:project) { create(:project, name: 'Experimental', description: 'An experiment project') }
it "renders the basic README" do
expect(subject.run_with(project)).to eq(<<~MARKDOWN.strip)
# Experimental
An experiment project
MARKDOWN
end
describe "the advanced variant" do
let(:markdown) { subject.run_with(project, variant: :advanced) }
let(:initial_url) { 'https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file' }
it "renders the project details" do
expect(markdown).to include(<<~MARKDOWN.strip)
# Experimental
An experiment project
## Getting started
MARKDOWN
end
it "renders redirect URLs" do
2021-10-27 15:23:28 +05:30
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)
2021-09-30 23:02:18 +05:30
end
end
end