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

user_creates_issue_by_email_spec.rb « issues « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d6d2b2a50f8953865b1e6b9ee8a4015964b2ef1c (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
44
45
46
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Issues > User creates issue by email', feature_category: :team_planning do
  let_it_be(:user) { create(:user) }
  let_it_be(:project) { create(:project, :public) }

  before do
    sign_in(user)

    project.add_developer(user)
  end

  describe 'new issue by email', :js do
    shared_examples 'show the email in the modal' do
      let(:issue) { create(:issue, project: project) }

      before do
        project.issues << issue
        stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab")

        visit project_issues_path(project)
        click_button('Email a new issue')
      end

      it 'click the button to show modal for the new email' do
        page.within '#issuable-email-modal' do
          email = project.new_issuable_address(user, 'issue')

          expect(page.find('input[type="text"]').value).to eq email
        end
      end
    end

    context 'with existing issues' do
      let!(:issue) { create(:issue, project: project, author: user) }

      it_behaves_like 'show the email in the modal'
    end

    context 'without existing issues' do
      it_behaves_like 'show the email in the modal'
    end
  end
end