Commit 9247490109b9d4e4691d304e7bfb4bca6d54e209
1 parent
09d5868c
Exists in
spb-stable
and in
3 other branches
Tests for accept MR with custom message
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
58 additions
and
25 deletions
Show diff stats
app/views/projects/merge_requests/show/_mr_accept.html.haml
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | %br |
| 19 | 19 | If you want to modify merge commit message - |
| 20 | 20 | %strong |
| 21 | - = link_to "click here", "#", class: "js-toggle-visibility-link", title: "Modify merge commit message" | |
| 21 | + = link_to "click here", "#", class: "modify-merge-commit-link js-toggle-visibility-link", title: "Modify merge commit message" | |
| 22 | 22 | |
| 23 | 23 | .js-toggle-visibility-container.hide |
| 24 | 24 | .form-group | ... | ... |
features/project/merge_requests.feature
| ... | ... | @@ -67,3 +67,13 @@ Feature: Project Merge Requests |
| 67 | 67 | And I leave a comment on the diff page |
| 68 | 68 | And I switch to the merge request's comments tab |
| 69 | 69 | Then I should see a discussion has started on commit bcf03b5de6c |
| 70 | + | |
| 71 | + @javascript | |
| 72 | + Scenario: I accept merge request with custom commit message | |
| 73 | + Given project "Shop" have "Bug NS-05" open merge request with diffs inside | |
| 74 | + And merge request "Bug NS-05" is mergeable | |
| 75 | + And I visit merge request page "Bug NS-05" | |
| 76 | + And merge request is mergeable | |
| 77 | + Then I modify merge commit message | |
| 78 | + And I accept this merge request | |
| 79 | + Then I should see merged request | ... | ... |
features/steps/project/project_merge_requests.rb
| ... | ... | @@ -4,60 +4,60 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 4 | 4 | include SharedNote |
| 5 | 5 | include SharedPaths |
| 6 | 6 | |
| 7 | - Given 'I click link "New Merge Request"' do | |
| 7 | + step 'I click link "New Merge Request"' do | |
| 8 | 8 | click_link "New Merge Request" |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | - Given 'I click link "Bug NS-04"' do | |
| 11 | + step 'I click link "Bug NS-04"' do | |
| 12 | 12 | click_link "Bug NS-04" |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | - Given 'I click link "All"' do | |
| 15 | + step 'I click link "All"' do | |
| 16 | 16 | click_link "All" |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | - Given 'I click link "Closed"' do | |
| 19 | + step 'I click link "Closed"' do | |
| 20 | 20 | click_link "Closed" |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | - Then 'I should see merge request "Wiki Feature"' do | |
| 23 | + step 'I should see merge request "Wiki Feature"' do | |
| 24 | 24 | within '.merge-request' do |
| 25 | 25 | page.should have_content "Wiki Feature" |
| 26 | 26 | end |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | - Then 'I should see closed merge request "Bug NS-04"' do | |
| 29 | + step 'I should see closed merge request "Bug NS-04"' do | |
| 30 | 30 | merge_request = MergeRequest.find_by_title!("Bug NS-04") |
| 31 | 31 | merge_request.closed?.should be_true |
| 32 | 32 | page.should have_content "Closed by" |
| 33 | 33 | end |
| 34 | 34 | |
| 35 | - Then 'I should see merge request "Bug NS-04"' do | |
| 35 | + step 'I should see merge request "Bug NS-04"' do | |
| 36 | 36 | page.should have_content "Bug NS-04" |
| 37 | 37 | end |
| 38 | 38 | |
| 39 | - Then 'I should see "Bug NS-04" in merge requests' do | |
| 39 | + step 'I should see "Bug NS-04" in merge requests' do | |
| 40 | 40 | page.should have_content "Bug NS-04" |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | - Then 'I should see "Feature NS-03" in merge requests' do | |
| 43 | + step 'I should see "Feature NS-03" in merge requests' do | |
| 44 | 44 | page.should have_content "Feature NS-03" |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | - And 'I should not see "Feature NS-03" in merge requests' do | |
| 47 | + step 'I should not see "Feature NS-03" in merge requests' do | |
| 48 | 48 | page.should_not have_content "Feature NS-03" |
| 49 | 49 | end |
| 50 | 50 | |
| 51 | 51 | |
| 52 | - And 'I should not see "Bug NS-04" in merge requests' do | |
| 52 | + step 'I should not see "Bug NS-04" in merge requests' do | |
| 53 | 53 | page.should_not have_content "Bug NS-04" |
| 54 | 54 | end |
| 55 | 55 | |
| 56 | - And 'I click link "Close"' do | |
| 56 | + step 'I click link "Close"' do | |
| 57 | 57 | click_link "Close" |
| 58 | 58 | end |
| 59 | 59 | |
| 60 | - And 'I submit new merge request "Wiki Feature"' do | |
| 60 | + step 'I submit new merge request "Wiki Feature"' do | |
| 61 | 61 | fill_in "merge_request_title", with: "Wiki Feature" |
| 62 | 62 | |
| 63 | 63 | # this must come first, so that the target branch is set |
| ... | ... | @@ -76,7 +76,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 76 | 76 | click_button "Submit merge request" |
| 77 | 77 | end |
| 78 | 78 | |
| 79 | - And 'project "Shop" have "Bug NS-04" open merge request' do | |
| 79 | + step 'project "Shop" have "Bug NS-04" open merge request' do | |
| 80 | 80 | create(:merge_request, |
| 81 | 81 | title: "Bug NS-04", |
| 82 | 82 | source_project: project, |
| ... | ... | @@ -84,7 +84,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 84 | 84 | author: project.users.first) |
| 85 | 85 | end |
| 86 | 86 | |
| 87 | - And 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do | |
| 87 | + step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do | |
| 88 | 88 | create(:merge_request_with_diffs, |
| 89 | 89 | title: "Bug NS-05", |
| 90 | 90 | source_project: project, |
| ... | ... | @@ -92,7 +92,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 92 | 92 | author: project.users.first) |
| 93 | 93 | end |
| 94 | 94 | |
| 95 | - And 'project "Shop" have "Feature NS-03" closed merge request' do | |
| 95 | + step 'project "Shop" have "Feature NS-03" closed merge request' do | |
| 96 | 96 | create(:closed_merge_request, |
| 97 | 97 | title: "Feature NS-03", |
| 98 | 98 | source_project: project, |
| ... | ... | @@ -100,19 +100,19 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 100 | 100 | author: project.users.first) |
| 101 | 101 | end |
| 102 | 102 | |
| 103 | - And 'I switch to the diff tab' do | |
| 103 | + step 'I switch to the diff tab' do | |
| 104 | 104 | visit diffs_project_merge_request_path(project, merge_request) |
| 105 | 105 | end |
| 106 | 106 | |
| 107 | - And 'I switch to the merge requests comments tab' do | |
| 107 | + step 'I switch to the merge requests comments tab' do | |
| 108 | 108 | visit project_merge_request_path(project, merge_request) |
| 109 | 109 | end |
| 110 | 110 | |
| 111 | - And 'I click on the first commit in the merge request' do | |
| 111 | + step 'I click on the first commit in the merge request' do | |
| 112 | 112 | click_link merge_request.commits.first.short_id(8) |
| 113 | 113 | end |
| 114 | 114 | |
| 115 | - And 'I leave a comment on the diff page' do | |
| 115 | + step 'I leave a comment on the diff page' do | |
| 116 | 116 | init_diff_note |
| 117 | 117 | |
| 118 | 118 | within('.js-discussion-note-form') do |
| ... | ... | @@ -125,7 +125,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 125 | 125 | end |
| 126 | 126 | end |
| 127 | 127 | |
| 128 | - And 'I leave a comment like "Line is wrong" on line 185 of the first file' do | |
| 128 | + step 'I leave a comment like "Line is wrong" on line 185 of the first file' do | |
| 129 | 129 | init_diff_note |
| 130 | 130 | |
| 131 | 131 | within(".js-discussion-note-form") do |
| ... | ... | @@ -138,24 +138,47 @@ class ProjectMergeRequests < Spinach::FeatureSteps |
| 138 | 138 | end |
| 139 | 139 | end |
| 140 | 140 | |
| 141 | - Then 'I should see a discussion has started on line 185' do | |
| 141 | + step 'I should see a discussion has started on line 185' do | |
| 142 | 142 | page.should have_content "#{current_user.name} started a discussion on this merge request diff" |
| 143 | 143 | page.should have_content "app/assets/stylesheets/tree.scss:L185" |
| 144 | 144 | page.should have_content "Line is wrong" |
| 145 | 145 | end |
| 146 | 146 | |
| 147 | - Then 'I should see a discussion has started on commit bcf03b5de6c:L185' do | |
| 147 | + step 'I should see a discussion has started on commit bcf03b5de6c:L185' do | |
| 148 | 148 | page.should have_content "#{current_user.name} started a discussion on commit" |
| 149 | 149 | page.should have_content "app/assets/stylesheets/tree.scss:L185" |
| 150 | 150 | page.should have_content "Line is wrong" |
| 151 | 151 | end |
| 152 | 152 | |
| 153 | - Then 'I should see a discussion has started on commit bcf03b5de6c' do | |
| 153 | + step 'I should see a discussion has started on commit bcf03b5de6c' do | |
| 154 | 154 | page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c" |
| 155 | 155 | page.should have_content "One comment to rule them all" |
| 156 | 156 | page.should have_content "app/assets/stylesheets/tree.scss:L185" |
| 157 | 157 | end |
| 158 | 158 | |
| 159 | + step 'merge request is mergeable' do | |
| 160 | + page.should have_content 'You can accept this request automatically' | |
| 161 | + end | |
| 162 | + | |
| 163 | + step 'I modify merge commit message' do | |
| 164 | + find('.modify-merge-commit-link').click | |
| 165 | + fill_in 'merge_commit_message', with: "wow such merge" | |
| 166 | + end | |
| 167 | + | |
| 168 | + step 'merge request "Bug NS-05" is mergeable' do | |
| 169 | + merge_request.mark_as_mergeable | |
| 170 | + end | |
| 171 | + | |
| 172 | + step 'I accept this merge request' do | |
| 173 | + click_button "Accept Merge Request" | |
| 174 | + end | |
| 175 | + | |
| 176 | + step 'I should see merged request' do | |
| 177 | + within '.page-title' do | |
| 178 | + page.should have_content "Merged" | |
| 179 | + end | |
| 180 | + end | |
| 181 | + | |
| 159 | 182 | def project |
| 160 | 183 | @project ||= Project.find_by_name!("Shop") |
| 161 | 184 | end | ... | ... |