Commit 380342784d3efbecb98de81c9b2679e3d720f7c9
1 parent
cee68dec
Exists in
spb-stable
and in
3 other branches
Fix MR spinach tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
7 changed files
with
74 additions
and
28 deletions
Show diff stats
app/models/merge_request.rb
@@ -142,7 +142,7 @@ class MergeRequest < ActiveRecord::Base | @@ -142,7 +142,7 @@ class MergeRequest < ActiveRecord::Base | ||
142 | end | 142 | end |
143 | 143 | ||
144 | def automerge!(current_user, commit_message = nil) | 144 | def automerge!(current_user, commit_message = nil) |
145 | - if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message) && self.unmerged_commits.empty? | 145 | + if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message) |
146 | self.merge!(current_user.id) | 146 | self.merge!(current_user.id) |
147 | true | 147 | true |
148 | end | 148 | end |
features/project/merge_requests.feature
@@ -55,18 +55,18 @@ Feature: Project Merge Requests | @@ -55,18 +55,18 @@ Feature: Project Merge Requests | ||
55 | Given project "Shop" have "Bug NS-05" open merge request with diffs inside | 55 | Given project "Shop" have "Bug NS-05" open merge request with diffs inside |
56 | And I visit merge request page "Bug NS-05" | 56 | And I visit merge request page "Bug NS-05" |
57 | And I click on the first commit in the merge request | 57 | And I click on the first commit in the merge request |
58 | - And I leave a comment like "Line is wrong" on line 185 of the first file | 58 | + And I leave a comment like "Line is wrong" on line 185 of the first file in commit |
59 | And I switch to the merge request's comments tab | 59 | And I switch to the merge request's comments tab |
60 | - Then I should see a discussion has started on commit bcf03b5de6c:L185 | 60 | + Then I should see a discussion has started on commit b1e6a9dbf1:L185 |
61 | 61 | ||
62 | @javascript | 62 | @javascript |
63 | Scenario: I comment on a commit in merge request | 63 | Scenario: I comment on a commit in merge request |
64 | Given project "Shop" have "Bug NS-05" open merge request with diffs inside | 64 | Given project "Shop" have "Bug NS-05" open merge request with diffs inside |
65 | And I visit merge request page "Bug NS-05" | 65 | And I visit merge request page "Bug NS-05" |
66 | And I click on the first commit in the merge request | 66 | And I click on the first commit in the merge request |
67 | - And I leave a comment on the diff page | 67 | + And I leave a comment on the diff page in commit |
68 | And I switch to the merge request's comments tab | 68 | And I switch to the merge request's comments tab |
69 | - Then I should see a discussion has started on commit bcf03b5de6c | 69 | + Then I should see a discussion has started on commit b1e6a9dbf1 |
70 | 70 | ||
71 | @javascript | 71 | @javascript |
72 | Scenario: I accept merge request with custom commit message | 72 | Scenario: I accept merge request with custom commit message |
features/steps/project/deploy_keys.rb
@@ -34,7 +34,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps | @@ -34,7 +34,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps | ||
34 | end | 34 | end |
35 | 35 | ||
36 | step 'other project has deploy key' do | 36 | step 'other project has deploy key' do |
37 | - @second_project = create :project, namespace: current_user.namespace | 37 | + @second_project = create :project, namespace: create(:group) |
38 | @second_project.team << [current_user, :master] | 38 | @second_project.team << [current_user, :master] |
39 | create(:deploy_keys_project, project: @second_project) | 39 | create(:deploy_keys_project, project: @second_project) |
40 | end | 40 | end |
features/steps/project/project_forked_merge_requests.rb
@@ -15,7 +15,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -15,7 +15,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
15 | @forking_user = @user | 15 | @forking_user = @user |
16 | forked_project_link = build(:forked_project_link) | 16 | forked_project_link = build(:forked_project_link) |
17 | @forked_project = Project.find_by_name "Forked Shop" | 17 | @forked_project = Project.find_by_name "Forked Shop" |
18 | - @forked_project ||= create(:source_project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) | 18 | + @forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) |
19 | 19 | ||
20 | forked_project_link.forked_from_project = @project | 20 | forked_project_link.forked_from_project = @project |
21 | forked_project_link.forked_to_project = @forked_project | 21 | forked_project_link.forked_to_project = @forked_project |
features/steps/project/project_merge_requests.rb
@@ -81,6 +81,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps | @@ -81,6 +81,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps | ||
81 | title: "Bug NS-04", | 81 | title: "Bug NS-04", |
82 | source_project: project, | 82 | source_project: project, |
83 | target_project: project, | 83 | target_project: project, |
84 | + source_branch: 'stable', | ||
85 | + target_branch: 'master', | ||
84 | author: project.users.first) | 86 | author: project.users.first) |
85 | end | 87 | end |
86 | 88 | ||
@@ -109,33 +111,29 @@ class ProjectMergeRequests < Spinach::FeatureSteps | @@ -109,33 +111,29 @@ class ProjectMergeRequests < Spinach::FeatureSteps | ||
109 | end | 111 | end |
110 | 112 | ||
111 | step 'I click on the first commit in the merge request' do | 113 | step 'I click on the first commit in the merge request' do |
112 | - click_link merge_request.commits.first.short_id(8) | 114 | + within '.first-commits' do |
115 | + click_link merge_request.commits.first.short_id(8) | ||
116 | + end | ||
113 | end | 117 | end |
114 | 118 | ||
115 | step 'I leave a comment on the diff page' do | 119 | step 'I leave a comment on the diff page' do |
116 | init_diff_note | 120 | init_diff_note |
121 | + leave_comment "One comment to rule them all" | ||
122 | + end | ||
117 | 123 | ||
118 | - within('.js-discussion-note-form') do | ||
119 | - fill_in "note_note", with: "One comment to rule them all" | ||
120 | - click_button "Add Comment" | ||
121 | - end | ||
122 | - | ||
123 | - within ".note-text" do | ||
124 | - page.should have_content "One comment to rule them all" | ||
125 | - end | 124 | + step 'I leave a comment on the diff page in commit' do |
125 | + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click | ||
126 | + leave_comment "One comment to rule them all" | ||
126 | end | 127 | end |
127 | 128 | ||
128 | step 'I leave a comment like "Line is wrong" on line 185 of the first file' do | 129 | step 'I leave a comment like "Line is wrong" on line 185 of the first file' do |
129 | init_diff_note | 130 | init_diff_note |
131 | + leave_comment "Line is wrong" | ||
132 | + end | ||
130 | 133 | ||
131 | - within(".js-discussion-note-form") do | ||
132 | - fill_in "note_note", with: "Line is wrong" | ||
133 | - click_button "Add Comment" | ||
134 | - end | ||
135 | - | ||
136 | - within ".note-text" do | ||
137 | - page.should have_content "Line is wrong" | ||
138 | - end | 134 | + step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do |
135 | + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click | ||
136 | + leave_comment "Line is wrong" | ||
139 | end | 137 | end |
140 | 138 | ||
141 | step 'I should see a discussion has started on line 185' do | 139 | step 'I should see a discussion has started on line 185' do |
@@ -144,14 +142,14 @@ class ProjectMergeRequests < Spinach::FeatureSteps | @@ -144,14 +142,14 @@ class ProjectMergeRequests < Spinach::FeatureSteps | ||
144 | page.should have_content "Line is wrong" | 142 | page.should have_content "Line is wrong" |
145 | end | 143 | end |
146 | 144 | ||
147 | - step 'I should see a discussion has started on commit bcf03b5de6c:L185' do | 145 | + step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do |
148 | page.should have_content "#{current_user.name} started a discussion on commit" | 146 | page.should have_content "#{current_user.name} started a discussion on commit" |
149 | page.should have_content "app/assets/stylesheets/tree.scss:L185" | 147 | page.should have_content "app/assets/stylesheets/tree.scss:L185" |
150 | page.should have_content "Line is wrong" | 148 | page.should have_content "Line is wrong" |
151 | end | 149 | end |
152 | 150 | ||
153 | - step 'I should see a discussion has started on commit bcf03b5de6c' do | ||
154 | - page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c" | 151 | + step 'I should see a discussion has started on commit b1e6a9dbf1' do |
152 | + page.should have_content "#{current_user.name} started a discussion on commit" | ||
155 | page.should have_content "One comment to rule them all" | 153 | page.should have_content "One comment to rule them all" |
156 | page.should have_content "app/assets/stylesheets/tree.scss:L185" | 154 | page.should have_content "app/assets/stylesheets/tree.scss:L185" |
157 | end | 155 | end |
@@ -188,6 +186,17 @@ class ProjectMergeRequests < Spinach::FeatureSteps | @@ -188,6 +186,17 @@ class ProjectMergeRequests < Spinach::FeatureSteps | ||
188 | end | 186 | end |
189 | 187 | ||
190 | def init_diff_note | 188 | def init_diff_note |
191 | - find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click | 189 | + find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click |
190 | + end | ||
191 | + | ||
192 | + def leave_comment(message) | ||
193 | + within(".js-discussion-note-form") do | ||
194 | + fill_in "note_note", with: message | ||
195 | + click_button "Add Comment" | ||
196 | + end | ||
197 | + | ||
198 | + within ".note-text" do | ||
199 | + page.should have_content message | ||
200 | + end | ||
192 | end | 201 | end |
193 | end | 202 | end |
spec/factories.rb
@@ -89,6 +89,39 @@ FactoryGirl.define do | @@ -89,6 +89,39 @@ FactoryGirl.define do | ||
89 | author | 89 | author |
90 | source_project factory: :project | 90 | source_project factory: :project |
91 | target_project { source_project } | 91 | target_project { source_project } |
92 | + | ||
93 | + # → git log stable..master --pretty=oneline | ||
94 | + # b1e6a9dbf1c85e6616497a5e7bad9143a4bd0828 tree css fixes | ||
95 | + # 8716fc78f3c65bbf7bcf7b574febd583bc5d2812 Added loading animation for notes | ||
96 | + # cd5c4bac5042c5469dcdf7e7b2f768d3c6fd7088 notes count for wall | ||
97 | + # 8470d70da67355c9c009e4401746b1d5410af2e3 notes controller refactored | ||
98 | + # 1e689bfba39525ead225eaf611948cfbe8ac34cf fixed notes logic | ||
99 | + # f0f14c8eaba69ebddd766498a9d0b0e79becd633 finished scss refactoring | ||
100 | + # 3a4b4fb4cde7809f033822a171b9feae19d41fff Moving ui styles to one scss file, Added ui class to body | ||
101 | + # 065c200c33f68c2bb781e35a43f9dc8138a893b5 removed unnecessary hr tags & titles | ||
102 | + # 1e8b111be85df0db6c8000ef9a710bc0221eae83 Merge branch 'master' of github.com:gitlabhq/gitlabhq | ||
103 | + # f403da73f5e62794a0447aca879360494b08f678 Fixed ajax loading image. Fixed wrong wording | ||
104 | + # e6ea73c77600d413d370249b8e392734f7d1dbee Merge pull request #468 from bencevans/patch-1 | ||
105 | + # 4a3c05b69355deee25767a74d0512ec4b510d4ef Merge pull request #470 from bgondy/patch-1 | ||
106 | + # 0347fe2412eb51d3efeccc35210e9268bc765ac5 Update app/views/projects/team.html.haml | ||
107 | + # 2b5c61bdece1f7eb2b901ceea7d364065cdf76ac Title for a link fixed | ||
108 | + # 460eeb13b7560b40104044973ff933b1a6dbbcaa Increased count of notes loaded when visit wall page | ||
109 | + # 21c141afb1c53a9180a99d2cca29ffa613eb7e3a Merge branch 'notes_refactoring' | ||
110 | + # 292a41cbe295f16f7148913b31eb0fb91f3251c3 Fixed comments for snippets. Tests fixed | ||
111 | + # d41d8ffb02fa74fd4571603548bd7e401ec99e0c Reply button, Comments for Merge Request diff | ||
112 | + # b1a36b552be2a7a6bc57fbed6c52dc6ed82111f8 Merge pull request #466 from skroutz/no-rbenv | ||
113 | + # db75dae913e8365453ca231f101b067314a7ea71 Merge pull request #465 from skroutz/branches_commit_link | ||
114 | + # 75f040fbfe4b5af23ff004ad3207c3976df097a8 Don't enforce rbenv version | ||
115 | + # e42fb4fda475370dcb0d8f8f1268bfdc7a0cc437 Fix broken commit link in branches page | ||
116 | + # 215a01f63ccdc085f75a48f6f7ab6f2b15b5852c move notes login to one controller | ||
117 | + # 81092c01984a481e312de10a28e3f1a6dda182a3 Status codes for errors, New error pages | ||
118 | + # 7d279f9302151e3c8f4c5df9c5200a72799409b9 better error handling for not found resource, gitolite error | ||
119 | + # 9e6d0710e927aa8ea834b8a9ae9f277be617ac7d Merge pull request #443 from CedricGatay/fix/incorrectLineNumberingInDiff | ||
120 | + # 6ea87c47f0f8a24ae031c3fff17bc913889ecd00 Incorrect line numbering in diff | ||
121 | + # | ||
122 | + # → git log master..stable --pretty=oneline | ||
123 | + # empty | ||
124 | + | ||
92 | source_branch "master" | 125 | source_branch "master" |
93 | target_branch "stable" | 126 | target_branch "stable" |
94 | 127 |
spec/support/test_env.rb
@@ -73,6 +73,10 @@ module TestEnv | @@ -73,6 +73,10 @@ module TestEnv | ||
73 | version: '6.3.0' | 73 | version: '6.3.0' |
74 | ) | 74 | ) |
75 | 75 | ||
76 | + Gitlab::Satellite::MergeAction.any_instance.stub( | ||
77 | + merge!: true, | ||
78 | + ) | ||
79 | + | ||
76 | Gitlab::Satellite::Satellite.any_instance.stub( | 80 | Gitlab::Satellite::Satellite.any_instance.stub( |
77 | exists?: true, | 81 | exists?: true, |
78 | destroy: true, | 82 | destroy: true, |