2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2015-04-26 12:48:37 +05:30
|
|
|
include Select2Helper
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
step 'I should see merge requests assigned to me' do
|
|
|
|
should_see(assigned_merge_request)
|
2015-04-26 12:48:37 +05:30
|
|
|
should_see(assigned_merge_request_from_fork)
|
2014-09-02 18:07:02 +05:30
|
|
|
should_not_see(authored_merge_request)
|
2015-04-26 12:48:37 +05:30
|
|
|
should_not_see(authored_merge_request_from_fork)
|
2014-09-02 18:07:02 +05:30
|
|
|
should_not_see(other_merge_request)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see merge requests authored by me' do
|
|
|
|
should_see(authored_merge_request)
|
2015-04-26 12:48:37 +05:30
|
|
|
should_see(authored_merge_request_from_fork)
|
2014-09-02 18:07:02 +05:30
|
|
|
should_not_see(assigned_merge_request)
|
2015-04-26 12:48:37 +05:30
|
|
|
should_not_see(assigned_merge_request_from_fork)
|
2014-09-02 18:07:02 +05:30
|
|
|
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
|
2015-04-26 12:48:37 +05:30
|
|
|
authored_merge_request_from_fork
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have assigned merge requests' do
|
|
|
|
assigned_merge_request
|
2015-04-26 12:48:37 +05:30
|
|
|
assigned_merge_request_from_fork
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have other merge requests' do
|
|
|
|
other_merge_request
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click "Authored by me" link' do
|
2016-06-02 11:05:42 +05:30
|
|
|
find("#assignee_id").set("")
|
|
|
|
find(".js-author-search", match: :first).click
|
|
|
|
find(".dropdown-menu-author li a", match: :first, text: current_user.to_reference).click
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click "All" link' do
|
2016-06-02 11:05:42 +05:30
|
|
|
find(".js-author-search").click
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_selector(".dropdown-menu-author li a")
|
2016-06-02 11:05:42 +05:30
|
|
|
find(".dropdown-menu-author li a", match: :first).click
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).not_to have_selector(".dropdown-menu-author li a")
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
find(".js-assignee-search").click
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).to have_selector(".dropdown-menu-assignee li a")
|
2016-06-02 11:05:42 +05:30
|
|
|
find(".dropdown-menu-assignee li a", match: :first).click
|
2016-09-13 17:45:13 +05:30
|
|
|
expect(page).not_to have_selector(".dropdown-menu-assignee li a")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def should_see(merge_request)
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content(merge_request.title[0..10])
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def should_not_see(merge_request)
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content(merge_request.title[0..10])
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def assigned_merge_request
|
2015-04-26 12:48:37 +05:30
|
|
|
@assigned_merge_request ||= create :merge_request,
|
|
|
|
assignee: current_user,
|
|
|
|
target_project: project,
|
|
|
|
source_project: project
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def authored_merge_request
|
2015-04-26 12:48:37 +05:30
|
|
|
@authored_merge_request ||= create :merge_request,
|
2015-09-25 12:07:36 +05:30
|
|
|
source_branch: 'markdown',
|
2015-04-26 12:48:37 +05:30
|
|
|
author: current_user,
|
|
|
|
target_project: project,
|
|
|
|
source_project: project
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def other_merge_request
|
2015-04-26 12:48:37 +05:30
|
|
|
@other_merge_request ||= create :merge_request,
|
2015-09-25 12:07:36 +05:30
|
|
|
source_branch: 'fix',
|
2015-04-26 12:48:37 +05:30
|
|
|
target_project: project,
|
|
|
|
source_project: project
|
|
|
|
end
|
|
|
|
|
|
|
|
def authored_merge_request_from_fork
|
|
|
|
@authored_merge_request_from_fork ||= create :merge_request,
|
2015-09-25 12:07:36 +05:30
|
|
|
source_branch: 'feature_conflict',
|
2015-04-26 12:48:37 +05:30
|
|
|
author: current_user,
|
|
|
|
target_project: public_project,
|
|
|
|
source_project: forked_project
|
|
|
|
end
|
|
|
|
|
|
|
|
def assigned_merge_request_from_fork
|
|
|
|
@assigned_merge_request_from_fork ||= create :merge_request,
|
2015-09-25 12:07:36 +05:30
|
|
|
source_branch: 'markdown',
|
2015-04-26 12:48:37 +05:30
|
|
|
assignee: current_user,
|
|
|
|
target_project: public_project,
|
|
|
|
source_project: forked_project
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
@project ||= begin
|
2016-06-02 11:05:42 +05:30
|
|
|
project = create :project
|
2014-09-02 18:07:02 +05:30
|
|
|
project.team << [current_user, :master]
|
|
|
|
project
|
|
|
|
end
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
def public_project
|
|
|
|
@public_project ||= create :project, :public
|
|
|
|
end
|
|
|
|
|
|
|
|
def forked_project
|
|
|
|
@forked_project ||= Projects::ForkService.new(public_project, current_user).execute
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|