2014-09-02 18:07:02 +05:30
|
|
|
class Spinach::Features::User < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedUser
|
|
|
|
include SharedProject
|
|
|
|
|
|
|
|
step 'I should see user "John Doe" page' do
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(title).to match(/^\s*John Doe/)
|
|
|
|
end
|
|
|
|
|
|
|
|
step '"John Doe" has contributions' do
|
|
|
|
user = User.find_by(name: 'John Doe')
|
|
|
|
project = contributed_project
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
# Issue contribution
|
2015-04-26 12:48:37 +05:30
|
|
|
issue_params = { title: 'Bug in old browser' }
|
|
|
|
Issues::CreateService.new(project, user, issue_params).execute
|
|
|
|
|
|
|
|
# Push code contribution
|
|
|
|
push_params = {
|
|
|
|
project: project,
|
|
|
|
action: Event::PUSHED,
|
|
|
|
author_id: user.id,
|
|
|
|
data: { commit_count: 3 }
|
|
|
|
}
|
|
|
|
|
|
|
|
Event.create(push_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see contributed projects' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '#contributed' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content(@contributed_project.name)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see contributions calendar' do
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_css('.js-contrib-calendar')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def contributed_project
|
|
|
|
@contributed_project ||= create(:project, :public)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|