diff options
Diffstat (limited to 'spec/features/projects/commits/user_browses_commits_spec.rb')
-rw-r--r-- | spec/features/projects/commits/user_browses_commits_spec.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb index b22715a44f0..7e59e36ccb7 100644 --- a/spec/features/projects/commits/user_browses_commits_spec.rb +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -76,16 +76,23 @@ describe 'User browses commits' do end context 'secondary email' do + let(:user) { create(:user) } + it 'finds a commit by a secondary email' do - user = - create(:user) do |user| - create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) - end + create(:email, :confirmed, user: user, email: 'dmitriy.zaporozhets@gmail.com') visit(project_commit_path(project, sample_commit.parent_id)) check_author_link(sample_commit.author_email, user) end + + it 'links to an unverified e-mail address instead of the user' do + create(:email, user: user, email: 'dmitriy.zaporozhets@gmail.com') + + visit(project_commit_path(project, sample_commit.parent_id)) + + check_author_email(sample_commit.author_email) + end end context 'when the blob does not exist' do @@ -263,3 +270,9 @@ def check_author_link(email, author) expect(author_link['href']).to eq(user_path(author)) expect(find('.commit-author-name').text).to eq(author.name) end + +def check_author_email(email) + author_link = find('.commit-author-link') + + expect(author_link['href']).to eq("mailto:#{email}") +end |