2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::ProjectCommitsUserLookup < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click on commit link' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_commit_path(@project, sample_commit.id)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click on another commit link' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_commit_path(@project, sample_commit.parent_id)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have user with primary email' do
|
|
|
|
user_primary
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have user with secondary email' do
|
|
|
|
user_secondary
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see author based on primary email' do
|
|
|
|
check_author_link(sample_commit.author_email, user_primary)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see author based on secondary email' do
|
|
|
|
check_author_link(sample_commit.author_email, user_secondary)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_author_link(email, user)
|
|
|
|
author_link = find('.commit-author-link')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(author_link['href']).to eq user_path(user)
|
2016-06-02 11:05:42 +05:30
|
|
|
expect(author_link['title']).to eq email
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(find('.commit-author-name').text).to eq user.name
|
2014-09-02 18:07:02 +05:30
|
|
|
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
|
|
|
|
end
|
|
|
|
end
|