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
|
|
|
|
|
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
|
2014-12-24 04:39:03 -05:00
|
|
|
within ".assignee-filter" do
|
|
|
|
click_link "Any"
|
|
|
|
end
|
|
|
|
within ".author-filter" do
|
|
|
|
click_link current_user.name
|
2012-09-10 04:51:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-12-24 12:04:57 -05:00
|
|
|
step 'I click "All" link' do
|
2014-12-24 04:39:03 -05:00
|
|
|
within ".author-filter" do
|
|
|
|
click_link "Any"
|
|
|
|
end
|
|
|
|
within ".assignee-filter" do
|
|
|
|
click_link "Any"
|
2013-12-24 12:04:57 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def should_see(issue)
|
|
|
|
page.should have_content(issue.title[0..10])
|
|
|
|
end
|
|
|
|
|
|
|
|
def should_not_see(issue)
|
|
|
|
page.should_not have_content(issue.title[0..10])
|
|
|
|
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
|
2014-01-22 14:03:52 -05: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
|