Welcome to mirror list, hosted at ThFree Co, Russian Federation.

new_project_readme_content_experiment_spec.rb « experiments « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 92a883078df39657cd85690646d7e9121a6d3428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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
      expect(markdown).to include(Rails.application.routes.url_helpers.experiment_redirect_url(subject, initial_url))
    end
  end
end