debian-mirror-gitlab/features/steps/dashboard/issues.rb

87 lines
2.1 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Spinach::Features::DashboardIssues < 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 issues assigned to me' do
should_see(assigned_issue)
should_not_see(authored_issue)
should_not_see(other_issue)
end
step 'I should see issues authored by me' do
should_see(authored_issue)
2015-04-26 12:48:37 +05:30
should_see(authored_issue_on_public_project)
2014-09-02 18:07:02 +05:30
should_not_see(assigned_issue)
should_not_see(other_issue)
end
step 'I should see all issues' do
should_see(authored_issue)
should_see(assigned_issue)
should_see(other_issue)
end
step 'I have authored issues' do
authored_issue
2015-04-26 12:48:37 +05:30
authored_issue_on_public_project
2014-09-02 18:07:02 +05:30
end
step 'I have assigned issues' do
assigned_issue
end
step 'I have other issues' do
other_issue
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
find(".dropdown-menu-author li a", match: :first).click
find(".js-assignee-search").click
find(".dropdown-menu-assignee li a", match: :first).click
2014-09-02 18:07:02 +05:30
end
def should_see(issue)
2015-09-11 14:41:01 +05:30
expect(page).to have_content(issue.title[0..10])
2014-09-02 18:07:02 +05:30
end
def should_not_see(issue)
2015-09-11 14:41:01 +05:30
expect(page).not_to have_content(issue.title[0..10])
2014-09-02 18:07:02 +05:30
end
def assigned_issue
@assigned_issue ||= create :issue, assignee: current_user, project: project
end
def authored_issue
@authored_issue ||= create :issue, author: current_user, project: project
end
def other_issue
@other_issue ||= create :issue, project: project
end
2015-04-26 12:48:37 +05:30
def authored_issue_on_public_project
@authored_issue_on_public_project ||= create :issue, author: current_user, project: public_project
end
2014-09-02 18:07:02 +05:30
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
2014-09-02 18:07:02 +05:30
end