2014-10-02 16:42:54 +00:00
|
|
|
class Spinach::Features::ProjectCommitsUserLookup < Spinach::FeatureSteps
|
2014-02-09 03:08:49 +00:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
2014-09-21 21:40:22 +00:00
|
|
|
step 'I click on commit link' do
|
2015-01-24 18:02:58 +00:00
|
|
|
visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
2014-09-21 21:40:22 +00:00
|
|
|
step 'I click on another commit link' do
|
2015-01-24 18:02:58 +00:00
|
|
|
visit namespace_project_commit_path(@project.namespace, @project, sample_commit.parent_id)
|
2014-07-31 14:23:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have user with primary email' do
|
|
|
|
user_primary
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have user with secondary email' do
|
|
|
|
user_secondary
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
2014-07-31 14:23:40 +00:00
|
|
|
step 'I see author based on primary email' do
|
|
|
|
check_author_link(sample_commit.author_email, user_primary)
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
2014-07-31 14:23:40 +00:00
|
|
|
|
|
|
|
step 'I see author based on secondary email' do
|
|
|
|
check_author_link(sample_commit.author_email, user_secondary)
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
2014-07-31 14:23:40 +00:00
|
|
|
def check_author_link(email, user)
|
2014-02-09 03:08:49 +00:00
|
|
|
author_link = find('.commit-author-link')
|
2014-07-31 14:23:40 +00:00
|
|
|
author_link['href'].should == user_path(user)
|
2014-02-09 03:08:49 +00:00
|
|
|
author_link['data-original-title'].should == email
|
2014-07-31 14:23:40 +00:00
|
|
|
find('.commit-author-name').text.should == user.name
|
|
|
|
end
|
|
|
|
|
|
|
|
def user_primary
|
|
|
|
@user_primary ||= create(:user, email: 'dmitriy.zaporozhets@gmail.com')
|
|
|
|
end
|
|
|
|
|
|
|
|
def user_secondary
|
|
|
|
@user_secondary ||= begin
|
|
|
|
user = create(:user, email: 'dzaporozhets@example.com')
|
|
|
|
create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' })
|
|
|
|
user
|
|
|
|
end
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
end
|