Commit 4b143e72 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Fix and improve stubbed test for WIP commit ref

parent 17881606
...@@ -400,37 +400,21 @@ describe MergeRequests::RefreshService do ...@@ -400,37 +400,21 @@ describe MergeRequests::RefreshService do
end end
it 'references the commit that caused the Work in Progress status' do it 'references the commit that caused the Work in Progress status' do
refresh_service.execute(@oldrev, @newrev, 'refs/heads/master') wip_merge_request = create(:merge_request,
allow(refresh_service).to receive(:find_new_commits) source_project: @project,
refresh_service.instance_variable_set("@commits", [ source_branch: 'wip',
double( target_branch: 'master',
id: 'aaaaaaa', target_project: @project)
sha: '38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e',
short_id: 'aaaaaaa', commits = wip_merge_request.commits
title: 'Fix issue', oldrev = commits.last.id
work_in_progress?: false newrev = commits.first.id
), wip_commit = wip_merge_request.commits.find(&:work_in_progress?)
double(
id: 'bbbbbbb', refresh_service.execute(oldrev, newrev, 'refs/heads/wip')
sha: '498214de67004b1da3d820901307bed2a68a8ef6',
short_id: 'bbbbbbb', expect(wip_merge_request.reload.notes.last.note).to eq(
title: 'fixup! Fix issue', "marked as a **Work In Progress** from #{wip_commit.id}"
work_in_progress?: true,
to_reference: 'bbbbbbb'
),
double(
id: 'ccccccc',
sha: '1b12f15a11fc6e62177bef08f47bc7b5ce50b141',
short_id: 'ccccccc',
title: 'fixup! Fix issue',
work_in_progress?: true,
to_reference: 'ccccccc'
)
])
refresh_service.execute(@oldrev, @newrev, 'refs/heads/wip')
reload_mrs
expect(@merge_request.notes.last.note).to eq(
"marked as a **Work In Progress** from bbbbbbb"
) )
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment