Commit 92474901 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Tests for accept MR with custom message

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 09d5868c
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
%br %br
If you want to modify merge commit message - If you want to modify merge commit message -
%strong %strong
= link_to "click here", "#", class: "js-toggle-visibility-link", title: "Modify merge commit message" = link_to "click here", "#", class: "modify-merge-commit-link js-toggle-visibility-link", title: "Modify merge commit message"
.js-toggle-visibility-container.hide .js-toggle-visibility-container.hide
.form-group .form-group
......
...@@ -67,3 +67,13 @@ Feature: Project Merge Requests ...@@ -67,3 +67,13 @@ Feature: Project Merge Requests
And I leave a comment on the diff page And I leave a comment on the diff page
And I switch to the merge request's comments tab And I switch to the merge request's comments tab
Then I should see a discussion has started on commit bcf03b5de6c Then I should see a discussion has started on commit bcf03b5de6c
@javascript
Scenario: I accept merge request with custom commit message
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And merge request "Bug NS-05" is mergeable
And I visit merge request page "Bug NS-05"
And merge request is mergeable
Then I modify merge commit message
And I accept this merge request
Then I should see merged request
...@@ -4,60 +4,60 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -4,60 +4,60 @@ class ProjectMergeRequests < Spinach::FeatureSteps
include SharedNote include SharedNote
include SharedPaths include SharedPaths
Given 'I click link "New Merge Request"' do step 'I click link "New Merge Request"' do
click_link "New Merge Request" click_link "New Merge Request"
end end
Given 'I click link "Bug NS-04"' do step 'I click link "Bug NS-04"' do
click_link "Bug NS-04" click_link "Bug NS-04"
end end
Given 'I click link "All"' do step 'I click link "All"' do
click_link "All" click_link "All"
end end
Given 'I click link "Closed"' do step 'I click link "Closed"' do
click_link "Closed" click_link "Closed"
end end
Then 'I should see merge request "Wiki Feature"' do step 'I should see merge request "Wiki Feature"' do
within '.merge-request' do within '.merge-request' do
page.should have_content "Wiki Feature" page.should have_content "Wiki Feature"
end end
end end
Then 'I should see closed merge request "Bug NS-04"' do step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by_title!("Bug NS-04") merge_request = MergeRequest.find_by_title!("Bug NS-04")
merge_request.closed?.should be_true merge_request.closed?.should be_true
page.should have_content "Closed by" page.should have_content "Closed by"
end end
Then 'I should see merge request "Bug NS-04"' do step 'I should see merge request "Bug NS-04"' do
page.should have_content "Bug NS-04" page.should have_content "Bug NS-04"
end end
Then 'I should see "Bug NS-04" in merge requests' do step 'I should see "Bug NS-04" in merge requests' do
page.should have_content "Bug NS-04" page.should have_content "Bug NS-04"
end end
Then 'I should see "Feature NS-03" in merge requests' do step 'I should see "Feature NS-03" in merge requests' do
page.should have_content "Feature NS-03" page.should have_content "Feature NS-03"
end end
And 'I should not see "Feature NS-03" in merge requests' do step 'I should not see "Feature NS-03" in merge requests' do
page.should_not have_content "Feature NS-03" page.should_not have_content "Feature NS-03"
end end
And 'I should not see "Bug NS-04" in merge requests' do step 'I should not see "Bug NS-04" in merge requests' do
page.should_not have_content "Bug NS-04" page.should_not have_content "Bug NS-04"
end end
And 'I click link "Close"' do step 'I click link "Close"' do
click_link "Close" click_link "Close"
end end
And 'I submit new merge request "Wiki Feature"' do step 'I submit new merge request "Wiki Feature"' do
fill_in "merge_request_title", with: "Wiki Feature" fill_in "merge_request_title", with: "Wiki Feature"
# this must come first, so that the target branch is set # this must come first, so that the target branch is set
...@@ -76,7 +76,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -76,7 +76,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
click_button "Submit merge request" click_button "Submit merge request"
end end
And 'project "Shop" have "Bug NS-04" open merge request' do step 'project "Shop" have "Bug NS-04" open merge request' do
create(:merge_request, create(:merge_request,
title: "Bug NS-04", title: "Bug NS-04",
source_project: project, source_project: project,
...@@ -84,7 +84,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -84,7 +84,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
author: project.users.first) author: project.users.first)
end end
And 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do
create(:merge_request_with_diffs, create(:merge_request_with_diffs,
title: "Bug NS-05", title: "Bug NS-05",
source_project: project, source_project: project,
...@@ -92,7 +92,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -92,7 +92,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
author: project.users.first) author: project.users.first)
end end
And 'project "Shop" have "Feature NS-03" closed merge request' do step 'project "Shop" have "Feature NS-03" closed merge request' do
create(:closed_merge_request, create(:closed_merge_request,
title: "Feature NS-03", title: "Feature NS-03",
source_project: project, source_project: project,
...@@ -100,19 +100,19 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -100,19 +100,19 @@ class ProjectMergeRequests < Spinach::FeatureSteps
author: project.users.first) author: project.users.first)
end end
And 'I switch to the diff tab' do step 'I switch to the diff tab' do
visit diffs_project_merge_request_path(project, merge_request) visit diffs_project_merge_request_path(project, merge_request)
end end
And 'I switch to the merge request\'s comments tab' do step 'I switch to the merge request\'s comments tab' do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
And 'I click on the first commit in the merge request' do step 'I click on the first commit in the merge request' do
click_link merge_request.commits.first.short_id(8) click_link merge_request.commits.first.short_id(8)
end end
And 'I leave a comment on the diff page' do step 'I leave a comment on the diff page' do
init_diff_note init_diff_note
within('.js-discussion-note-form') do within('.js-discussion-note-form') do
...@@ -125,7 +125,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -125,7 +125,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
end end
And 'I leave a comment like "Line is wrong" on line 185 of the first file' do step 'I leave a comment like "Line is wrong" on line 185 of the first file' do
init_diff_note init_diff_note
within(".js-discussion-note-form") do within(".js-discussion-note-form") do
...@@ -138,24 +138,47 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -138,24 +138,47 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
end end
Then 'I should see a discussion has started on line 185' do step 'I should see a discussion has started on line 185' do
page.should have_content "#{current_user.name} started a discussion on this merge request diff" page.should have_content "#{current_user.name} started a discussion on this merge request diff"
page.should have_content "app/assets/stylesheets/tree.scss:L185" page.should have_content "app/assets/stylesheets/tree.scss:L185"
page.should have_content "Line is wrong" page.should have_content "Line is wrong"
end end
Then 'I should see a discussion has started on commit bcf03b5de6c:L185' do step 'I should see a discussion has started on commit bcf03b5de6c:L185' do
page.should have_content "#{current_user.name} started a discussion on commit" page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content "app/assets/stylesheets/tree.scss:L185" page.should have_content "app/assets/stylesheets/tree.scss:L185"
page.should have_content "Line is wrong" page.should have_content "Line is wrong"
end end
Then 'I should see a discussion has started on commit bcf03b5de6c' do step 'I should see a discussion has started on commit bcf03b5de6c' do
page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c" page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c"
page.should have_content "One comment to rule them all" page.should have_content "One comment to rule them all"
page.should have_content "app/assets/stylesheets/tree.scss:L185" page.should have_content "app/assets/stylesheets/tree.scss:L185"
end end
step 'merge request is mergeable' do
page.should have_content 'You can accept this request automatically'
end
step 'I modify merge commit message' do
find('.modify-merge-commit-link').click
fill_in 'merge_commit_message', with: "wow such merge"
end
step 'merge request "Bug NS-05" is mergeable' do
merge_request.mark_as_mergeable
end
step 'I accept this merge request' do
click_button "Accept Merge Request"
end
step 'I should see merged request' do
within '.page-title' do
page.should have_content "Merged"
end
end
def project def project
@project ||= Project.find_by_name!("Shop") @project ||= Project.find_by_name!("Shop")
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