2014-09-22 14:30:25 +00:00
|
|
|
class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
|
2012-09-10 15:35:03 +00:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2015-03-27 07:27:51 +00:00
|
|
|
include Select2Helper
|
2012-09-10 15:35:03 +00:00
|
|
|
|
2013-12-24 16:22:48 +00:00
|
|
|
step 'I should see merge requests assigned to me' do
|
|
|
|
should_see(assigned_merge_request)
|
2014-10-27 08:53:35 +00:00
|
|
|
should_see(assigned_merge_request_from_fork)
|
2013-12-24 16:22:48 +00:00
|
|
|
should_not_see(authored_merge_request)
|
2014-10-27 08:53:35 +00:00
|
|
|
should_not_see(authored_merge_request_from_fork)
|
2013-12-24 16:22:48 +00:00
|
|
|
should_not_see(other_merge_request)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see merge requests authored by me' do
|
|
|
|
should_see(authored_merge_request)
|
2014-10-27 08:30:39 +00:00
|
|
|
should_see(authored_merge_request_from_fork)
|
2013-12-24 16:22:48 +00:00
|
|
|
should_not_see(assigned_merge_request)
|
2014-10-27 08:53:35 +00:00
|
|
|
should_not_see(assigned_merge_request_from_fork)
|
2013-12-24 16:22:48 +00:00
|
|
|
should_not_see(other_merge_request)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see all merge requests' do
|
|
|
|
should_see(authored_merge_request)
|
|
|
|
should_see(assigned_merge_request)
|
|
|
|
should_see(other_merge_request)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have authored merge requests' do
|
|
|
|
authored_merge_request
|
2014-10-27 08:30:39 +00:00
|
|
|
authored_merge_request_from_fork
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have assigned merge requests' do
|
|
|
|
assigned_merge_request
|
2014-10-27 08:53:35 +00:00
|
|
|
assigned_merge_request_from_fork
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have other merge requests' do
|
|
|
|
other_merge_request
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click "Authored by me" link' do
|
2015-03-27 07:27:51 +00:00
|
|
|
select2(current_user.id, from: "#author_id")
|
|
|
|
select2(nil, from: "#assignee_id")
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click "All" link' do
|
2015-03-27 07:27:51 +00:00
|
|
|
select2(nil, from: "#author_id")
|
|
|
|
select2(nil, from: "#assignee_id")
|
2012-09-10 08:51:02 +00:00
|
|
|
end
|
|
|
|
|
2013-12-24 16:22:48 +00:00
|
|
|
def should_see(merge_request)
|
2015-06-12 04:44:13 +00:00
|
|
|
expect(page).to have_content(merge_request.title[0..10])
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
2012-09-10 08:51:02 +00:00
|
|
|
|
2013-12-24 16:22:48 +00:00
|
|
|
def should_not_see(merge_request)
|
2015-06-12 04:44:13 +00:00
|
|
|
expect(page).not_to have_content(merge_request.title[0..10])
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
2012-09-10 08:51:02 +00:00
|
|
|
|
2013-12-24 16:22:48 +00:00
|
|
|
def assigned_merge_request
|
2014-10-27 08:53:35 +00:00
|
|
|
@assigned_merge_request ||= create :merge_request,
|
|
|
|
assignee: current_user,
|
|
|
|
target_project: project,
|
|
|
|
source_project: project
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def authored_merge_request
|
2014-10-27 08:30:39 +00:00
|
|
|
@authored_merge_request ||= create :merge_request,
|
2015-08-11 12:33:31 +00:00
|
|
|
source_branch: 'markdown',
|
2014-10-27 08:30:39 +00:00
|
|
|
author: current_user,
|
|
|
|
target_project: project,
|
|
|
|
source_project: project
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def other_merge_request
|
2014-10-27 08:30:39 +00:00
|
|
|
@other_merge_request ||= create :merge_request,
|
2015-08-11 12:33:31 +00:00
|
|
|
source_branch: 'fix',
|
2014-10-27 08:30:39 +00:00
|
|
|
target_project: project,
|
|
|
|
source_project: project
|
|
|
|
end
|
|
|
|
|
|
|
|
def authored_merge_request_from_fork
|
|
|
|
@authored_merge_request_from_fork ||= create :merge_request,
|
2015-08-11 12:33:31 +00:00
|
|
|
source_branch: 'feature_conflict',
|
2014-10-27 08:30:39 +00:00
|
|
|
author: current_user,
|
|
|
|
target_project: public_project,
|
|
|
|
source_project: forked_project
|
2013-12-24 16:22:48 +00:00
|
|
|
end
|
2013-04-25 14:15:33 +00:00
|
|
|
|
2014-10-27 08:53:35 +00:00
|
|
|
def assigned_merge_request_from_fork
|
|
|
|
@assigned_merge_request_from_fork ||= create :merge_request,
|
2015-08-11 12:33:31 +00:00
|
|
|
source_branch: 'markdown',
|
2014-10-27 08:53:35 +00:00
|
|
|
assignee: current_user,
|
|
|
|
target_project: public_project,
|
|
|
|
source_project: forked_project
|
|
|
|
end
|
|
|
|
|
2013-12-24 16:22:48 +00:00
|
|
|
def project
|
|
|
|
@project ||= begin
|
2014-01-22 19:03:52 +00:00
|
|
|
project =create :project
|
2013-12-24 16:22:48 +00:00
|
|
|
project.team << [current_user, :master]
|
|
|
|
project
|
|
|
|
end
|
2012-09-10 08:51:02 +00:00
|
|
|
end
|
2014-10-27 08:30:39 +00:00
|
|
|
|
|
|
|
def public_project
|
|
|
|
@public_project ||= create :project, :public
|
|
|
|
end
|
|
|
|
|
|
|
|
def forked_project
|
|
|
|
@forked_project ||= Projects::ForkService.new(public_project, current_user).execute
|
|
|
|
end
|
2012-09-10 08:51:02 +00:00
|
|
|
end
|