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

example_snapshot_fixtures.rb « glfm « shared_contexts « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22b401bc8413e8a695d6ae99815626664edfc41e (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
# frozen_string_literal: true

RSpec.shared_context 'with GLFM example snapshot fixtures' do
  let_it_be(:user) { create(:user) }
  let_it_be(:group) { create(:group, name: 'glfm_group').tap { |group| group.add_owner(user) } }

  let_it_be(:project) do
    # NOTE: We hardcode the IDs on all fixtures to prevent variability in the
    #       rendered HTML/Prosemirror JSON, and to minimize the need for normalization:
    #       https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#normalization
    create(:project, :repository, creator: user, group: group, name: 'glfm_project', id: 77777)
  end

  let_it_be(:project_snippet) { create(:project_snippet, title: 'glfm_project_snippet', id: 88888, project: project) }
  let_it_be(:personal_snippet) { create(:snippet, id: 99999) }

  before do
    # Set 'GITLAB_TEST_FOOTNOTE_ID' in order to override random number generation in
    # Banzai::Filter::FootnoteFilter#random_number, and thus avoid the need to
    # perform normalization on the value. See:
    # https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#normalization
    stub_env('GITLAB_TEST_FOOTNOTE_ID', 42)

    stub_licensed_features(group_wikis: true)
    sign_in(user)
  end
end