2014-01-27 09:53:59 -05:00
|
|
|
class Spinach::Features::User < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedUser
|
|
|
|
include SharedProject
|
|
|
|
|
|
|
|
step 'I should see user "John Doe" page' do
|
2014-09-24 02:28:41 -04:00
|
|
|
expect(title).to match(/^\s*John Doe/)
|
2014-01-27 09:53:59 -05:00
|
|
|
end
|
2015-03-22 16:55:00 -04:00
|
|
|
|
|
|
|
step '"John Doe" has contributions' do
|
|
|
|
user = User.find_by(name: 'John Doe')
|
|
|
|
project = contributed_project
|
|
|
|
|
2016-04-27 05:45:50 -04:00
|
|
|
# Issue contribution
|
2015-03-22 16:55:00 -04:00
|
|
|
issue_params = { title: 'Bug in old browser' }
|
|
|
|
Issues::CreateService.new(project, user, issue_params).execute
|
|
|
|
|
|
|
|
# Push code contribution
|
2017-08-30 09:38:16 -04:00
|
|
|
event = create(:push_event, project: project, author: user)
|
|
|
|
|
|
|
|
create(:push_event_payload, event: event, commit_count: 3)
|
2015-03-22 16:55:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see contributed projects' do
|
2016-04-27 07:36:04 -04:00
|
|
|
page.within '#contributed' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content(@contributed_project.name)
|
2015-03-22 16:55:00 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see contributions calendar' do
|
2016-04-27 07:45:14 -04:00
|
|
|
expect(page).to have_css('.js-contrib-calendar')
|
2015-03-22 16:55:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def contributed_project
|
2017-08-30 09:38:16 -04:00
|
|
|
@contributed_project ||= create(:project, :public, :empty_repo)
|
2015-03-22 16:55:00 -04:00
|
|
|
end
|
2014-01-27 09:53:59 -05:00
|
|
|
end
|