blob: 073669f033ce004e0064786346fcb8ad6604c6d7 (
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
47
48
49
50
|
# frozen_string_literal: true
require 'airborne'
module QA
RSpec.describe 'Plan' do
include Support::API
describe 'Issue' do
let(:issue) do
Resource::Issue.fabricate_via_api!
end
let(:issue_id) { issue.api_response[:iid] }
let(:api_client) { Runtime::API::Client.new(:gitlab) }
before do
# Initial commit should be pushed because
# the very first commit to the project doesn't close the issue
# https://gitlab.com/gitlab-org/gitlab-foss/issues/38965
push_commit('Initial commit')
end
it 'closes via pushing a commit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347947' do
push_commit("Closes ##{issue_id}", false)
Support::Retrier.retry_until(max_duration: 10, sleep_interval: 1) do
issue_closed?
end
end
private
def push_commit(commit_message, new_branch = true)
Resource::Repository::ProjectPush.fabricate! do |push|
push.commit_message = commit_message
push.new_branch = new_branch
push.file_content = commit_message
push.project = issue.project
end
end
def issue_closed?
response = get Runtime::API::Request.new(api_client, "/projects/#{issue.project.id}/issues/#{issue_id}").url
parse_body(response)[:state] == 'closed'
end
end
end
end
|