2014-09-22 10:30:25 -04:00
|
|
|
class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
|
2012-09-10 11:35:03 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2015-03-27 03:27:51 -04:00
|
|
|
include Select2Helper
|
2012-09-10 11:35:03 -04:00
|
|
|
|
2013-12-24 12:04:57 -05:00
|
|
|
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)
|
2014-10-27 04:20:43 -04:00
|
|
|
should_see(authored_issue_on_public_project)
|
2013-12-24 12:04:57 -05:00
|
|
|
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
|
2014-10-27 04:20:43 -04:00
|
|
|
authored_issue_on_public_project
|
2013-12-24 12:04:57 -05:00
|
|
|
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-03-14 09:49:53 -04:00
|
|
|
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
|
2012-09-10 04:51:02 -04:00
|
|
|
end
|
|
|
|
|
2013-12-24 12:04:57 -05:00
|
|
|
step 'I click "All" link' do
|
2016-03-27 13:18:21 -04:00
|
|
|
find(".js-author-search").click
|
2016-08-11 12:48:32 -04:00
|
|
|
expect(page).to have_selector(".dropdown-menu-author li a")
|
2016-03-27 13:18:21 -04:00
|
|
|
find(".dropdown-menu-author li a", match: :first).click
|
2016-08-11 12:48:32 -04:00
|
|
|
expect(page).not_to have_selector(".dropdown-menu-author li a")
|
|
|
|
|
2016-03-27 13:18:21 -04:00
|
|
|
find(".js-assignee-search").click
|
2016-08-11 12:48:32 -04:00
|
|
|
expect(page).to have_selector(".dropdown-menu-assignee li a")
|
2016-03-27 13:18:21 -04:00
|
|
|
find(".dropdown-menu-assignee li a", match: :first).click
|
2016-08-11 12:48:32 -04:00
|
|
|
expect(page).not_to have_selector(".dropdown-menu-assignee li a")
|
2013-12-24 12:04:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def should_see(issue)
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content(issue.title[0..10])
|
2013-12-24 12:04:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def should_not_see(issue)
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content(issue.title[0..10])
|
2013-12-24 12:04:57 -05:00
|
|
|
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
|
2012-09-10 04:51:02 -04:00
|
|
|
|
2014-10-27 04:20:43 -04:00
|
|
|
def authored_issue_on_public_project
|
|
|
|
@authored_issue_on_public_project ||= create :issue, author: current_user, project: public_project
|
|
|
|
end
|
|
|
|
|
2013-12-24 12:04:57 -05:00
|
|
|
def project
|
|
|
|
@project ||= begin
|
2016-05-10 22:58:06 -04:00
|
|
|
project = create :project
|
2013-12-24 12:04:57 -05:00
|
|
|
project.team << [current_user, :master]
|
|
|
|
project
|
|
|
|
end
|
2012-09-10 04:51:02 -04:00
|
|
|
end
|
2014-10-27 04:20:43 -04:00
|
|
|
|
|
|
|
def public_project
|
|
|
|
@public_project ||= create :project, :public
|
|
|
|
end
|
2012-09-10 04:51:02 -04:00
|
|
|
end
|