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

autocomplete_shared_examples.rb « wiki « features « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 79de2aedf3bdf403d095819737e9478ea8c9e9cf (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
37
38
39
40
41
42
43
# frozen_string_literal: true

RSpec.shared_examples 'autocompletes items' do
  before do
    if defined?(project)
      create(:issue, project: project, title: 'My Cool Linked Issue')
      create(:merge_request, source_project: project, title: 'My Cool Merge Request')
      create(:label, project: project, title: 'My Cool Label')
      create(:milestone, project: project, title: 'My Cool Milestone')

      project.add_maintainer(create(:user, name: 'JohnDoe123'))
    else # group wikis
      project = create(:project, group: group)

      create(:issue, project: project, title: 'My Cool Linked Issue')
      create(:merge_request, source_project: project, title: 'My Cool Merge Request')
      create(:group_label, group: group, title: 'My Cool Label')
      create(:milestone, group: group, title: 'My Cool Milestone')

      project.add_maintainer(create(:user, name: 'JohnDoe123'))
    end
  end

  it 'works well for issues, labels, MRs, members, etc' do
    fill_in :wiki_content, with: "#"
    expect(page).to have_text 'My Cool Linked Issue'

    fill_in :wiki_content, with: "~"
    expect(page).to have_text 'My Cool Label'

    fill_in :wiki_content, with: "!"
    expect(page).to have_text 'My Cool Merge Request'

    fill_in :wiki_content, with: "%"
    expect(page).to have_text 'My Cool Milestone'

    fill_in :wiki_content, with: "@"
    expect(page).to have_text 'JohnDoe123'

    fill_in :wiki_content, with: ':smil'
    expect(page).to have_text 'smile_cat'
  end
end