2012-09-10 15:35:23 +02:00
|
|
|
class ProjectMergeRequests < Spinach::FeatureSteps
|
2012-09-10 17:35:03 +02:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedNote
|
|
|
|
include SharedPaths
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Given 'I click link "New Merge Request"' do
|
|
|
|
click_link "New Merge Request"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Given 'I click link "Bug NS-04"' do
|
|
|
|
click_link "Bug NS-04"
|
|
|
|
end
|
|
|
|
|
|
|
|
Given 'I click link "All"' do
|
|
|
|
click_link "All"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
Given 'I click link "Closed"' do
|
|
|
|
click_link "Closed"
|
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Then 'I should see merge request "Wiki Feature"' do
|
|
|
|
page.should have_content "Wiki Feature"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Then 'I should see closed merge request "Bug NS-04"' do
|
2013-02-28 08:43:48 +01:00
|
|
|
merge_request = MergeRequest.find_by_title!("Bug NS-04")
|
|
|
|
merge_request.closed?.should be_true
|
2012-10-29 22:23:49 +01:00
|
|
|
page.should have_content "Closed by"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Then 'I should see merge request "Bug NS-04"' do
|
|
|
|
page.should have_content "Bug NS-04"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Then 'I should see "Bug NS-04" in merge requests' do
|
|
|
|
page.should have_content "Bug NS-04"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
Then 'I should see "Feature NS-03" in merge requests' do
|
|
|
|
page.should have_content "Feature NS-03"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
And 'I should not see "Feature NS-03" in merge requests' do
|
|
|
|
page.should_not have_content "Feature NS-03"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
|
|
|
|
And 'I should not see "Bug NS-04" in merge requests' do
|
|
|
|
page.should_not have_content "Bug NS-04"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
2012-10-29 22:23:49 +01:00
|
|
|
And 'I click link "Close"' do
|
|
|
|
click_link "Close"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I submit new merge request "Wiki Feature"' do
|
|
|
|
fill_in "merge_request_title", :with => "Wiki Feature"
|
|
|
|
select "master", :from => "merge_request_source_branch"
|
|
|
|
select "stable", :from => "merge_request_target_branch"
|
2013-01-05 23:08:02 +01:00
|
|
|
click_button "Submit merge request"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'project "Shop" have "Bug NS-04" open merge request' do
|
2013-02-18 13:49:56 +01:00
|
|
|
create(:merge_request,
|
2012-10-29 22:23:49 +01:00
|
|
|
title: "Bug NS-04",
|
|
|
|
project: project,
|
|
|
|
author: project.users.first)
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do
|
|
|
|
create(:merge_request_with_diffs,
|
|
|
|
title: "Bug NS-05",
|
|
|
|
project: project,
|
|
|
|
author: project.users.first)
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'project "Shop" have "Feature NS-03" closed merge request' do
|
2013-02-18 11:43:08 +01:00
|
|
|
create(:closed_merge_request,
|
2012-10-29 22:23:49 +01:00
|
|
|
title: "Feature NS-03",
|
|
|
|
project: project,
|
2013-02-18 11:43:08 +01:00
|
|
|
author: project.users.first)
|
2012-10-29 22:23:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I switch to the diff tab' do
|
2013-02-28 08:43:48 +01:00
|
|
|
visit diffs_project_merge_request_path(merge_request.project, merge_request)
|
2012-10-29 22:23:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I switch to the merge request\'s comments tab' do
|
2013-02-28 08:43:48 +01:00
|
|
|
visit project_merge_request_path(merge_request.project, merge_request)
|
2012-10-29 22:23:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I click on the first commit in the merge request' do
|
2013-02-28 08:43:48 +01:00
|
|
|
|
|
|
|
click_link merge_request.commits.first.short_id(8)
|
2012-10-29 22:23:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I leave a comment on the diff page' do
|
2013-01-15 16:12:53 +01:00
|
|
|
find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185 .add-diff-note").click
|
|
|
|
|
2013-01-15 13:28:04 +01:00
|
|
|
within('.js-temp-notes-holder') do
|
2012-10-29 22:23:49 +01:00
|
|
|
fill_in "note_note", with: "One comment to rule them all"
|
|
|
|
click_button "Add Comment"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I leave a comment like "Line is wrong" on line 185 of the first file' do
|
2013-01-15 13:28:04 +01:00
|
|
|
find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185 .add-diff-note").click
|
2012-10-29 22:23:49 +01:00
|
|
|
|
2013-01-15 13:28:04 +01:00
|
|
|
within(".js-temp-notes-holder") do
|
2012-10-29 22:23:49 +01:00
|
|
|
fill_in "note_note", with: "Line is wrong"
|
|
|
|
click_button "Add Comment"
|
2013-01-15 13:28:04 +01:00
|
|
|
sleep 0.05
|
2012-10-29 22:23:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see a discussion has started on line 185' do
|
2013-02-28 08:43:48 +01:00
|
|
|
first_commit = merge_request.commits.first
|
2013-01-15 16:12:53 +01:00
|
|
|
first_diff = first_commit.diffs.first
|
2012-10-29 22:23:49 +01:00
|
|
|
page.should have_content "#{current_user.name} started a discussion on this merge request diff"
|
|
|
|
page.should have_content "#{first_diff.b_path}:L185"
|
|
|
|
page.should have_content "Line is wrong"
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see a discussion has started on commit bcf03b5de6c:L185' do
|
2013-02-28 08:43:48 +01:00
|
|
|
first_commit = merge_request.commits.first
|
2013-01-15 16:12:53 +01:00
|
|
|
first_diff = first_commit.diffs.first
|
2012-10-29 22:23:49 +01:00
|
|
|
page.should have_content "#{current_user.name} started a discussion on commit"
|
|
|
|
page.should have_content first_commit.short_id(8)
|
|
|
|
page.should have_content "#{first_diff.b_path}:L185"
|
|
|
|
page.should have_content "Line is wrong"
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see a discussion has started on commit bcf03b5de6c' do
|
2013-02-28 08:43:48 +01:00
|
|
|
first_commit = merge_request.st_commits.first
|
2013-01-15 16:12:53 +01:00
|
|
|
first_diff = first_commit.diffs.first
|
|
|
|
page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c"
|
2012-10-29 22:23:49 +01:00
|
|
|
page.should have_content first_commit.short_id(8)
|
|
|
|
page.should have_content "One comment to rule them all"
|
2013-01-15 16:12:53 +01:00
|
|
|
page.should have_content "#{first_diff.b_path}:L185"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
2013-02-28 08:43:48 +01:00
|
|
|
|
|
|
|
def project
|
|
|
|
@project ||= Project.find_by_name!("Shop")
|
|
|
|
end
|
|
|
|
|
|
|
|
def merge_request
|
|
|
|
@merge_request ||= MergeRequest.find_by_title!("Bug NS-05")
|
|
|
|
end
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|