summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-01-19 15:46:25 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-01-19 15:46:25 +0000
commitb67a1b6017f27a2ecf228dced52a1e42d872b270 (patch)
tree0fad06a84a4a518b9cc5c3ab7b3d6531c2134df9 /spec/features
parent0ece506e39a475082605218fd14e4b1d1bd55cef (diff)
parentea7bf7eda44db68b6a8aadfff3afe8117a510989 (diff)
downloadgitlab-ce-b67a1b6017f27a2ecf228dced52a1e42d872b270.tar.gz
Merge branch 'wip-mr-from-commits' into 'master'
Mark MR as WIP when pushing WIP commits Closes #25036 See merge request !8124
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/merge_requests/wip_message_spec.rb63
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/features/merge_requests/wip_message_spec.rb b/spec/features/merge_requests/wip_message_spec.rb
new file mode 100644
index 00000000000..3311731b33b
--- /dev/null
+++ b/spec/features/merge_requests/wip_message_spec.rb
@@ -0,0 +1,63 @@
+require 'spec_helper'
+
+feature 'Work In Progress help message', feature: true do
+ let!(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) }
+ let!(:user) { create(:user) }
+
+ before do
+ project.team << [user, :master]
+ login_as(user)
+ end
+
+ context 'with WIP commits' do
+ it 'shows a specific WIP hint' do
+ visit new_namespace_project_merge_request_path(
+ project.namespace,
+ project,
+ merge_request: {
+ source_project_id: project.id,
+ target_project_id: project.id,
+ source_branch: 'wip',
+ target_branch: 'master'
+ }
+ )
+
+ within_wip_explanation do
+ expect(page).to have_text(
+ 'It looks like you have some WIP commits in this branch'
+ )
+ end
+ end
+ end
+
+ context 'without WIP commits' do
+ it 'shows the regular WIP message' do
+ visit new_namespace_project_merge_request_path(
+ project.namespace,
+ project,
+ merge_request: {
+ source_project_id: project.id,
+ target_project_id: project.id,
+ source_branch: 'fix',
+ target_branch: 'master'
+ }
+ )
+
+ within_wip_explanation do
+ expect(page).not_to have_text(
+ 'It looks like you have some WIP commits in this branch'
+ )
+ expect(page).to have_text(
+ "Start the title with WIP: to prevent a Work In Progress merge \
+request from being merged before it's ready"
+ )
+ end
+ end
+ end
+
+ def within_wip_explanation(&block)
+ page.within '.js-no-wip-explanation' do
+ yield
+ end
+ end
+end