Skip to content
代码片段 群组 项目
提交 aec34658 编辑于 作者: Dylan Griffith's avatar Dylan Griffith
浏览文件

Add spec for housekeeper --target-branch

This adds the test coverage for the feature added in the earlier commit.
上级 35ecc26c
No related branches found
No related tags found
1 合并请求!2419Fix TanukiBot spec relying on outdated code
......@@ -135,6 +135,36 @@
expect(change2.keep_class).to eq(fake_keep)
end
context 'when given target_branch' do
it 'branches from that target branch' do
# Branches get created
expect(::Gitlab::Housekeeper::Git).to receive(:new)
.with(logger: anything, branch_from: 'the-target-branch')
.and_return(git)
# Branches get shown and pushed
expect(::Gitlab::Housekeeper::Shell).to receive(:execute)
.with('git', '--no-pager', 'diff', '--color=always', 'the-target-branch',
'the-identifier-for-the-first-change', '--', 'change1.txt', 'change2.txt')
# Merge requests get created
expect(gitlab_client).to receive(:create_or_update_merge_request)
.with(
change: change1,
source_project_id: '123',
source_branch: 'the-identifier-for-the-first-change',
target_branch: 'the-target-branch',
target_project_id: '456',
update_title: true,
update_description: true,
update_labels: true,
update_reviewers: true
).twice.and_return({ 'web_url' => 'https://example.com' })
described_class.new(max_mrs: 1, keeps: [fake_keep], target_branch: 'the-target-branch').run
end
end
context 'when given filter_identifiers' do
it 'skips a change that does not match the filter_identifiers' do
# Branches get created
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册