diff options
author | Robert Speicher <robert@gitlab.com> | 2017-08-30 15:27:09 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-08-30 15:27:09 +0000 |
commit | f7c8434c7100c3c87eb2a75cd5a128e520d8c110 (patch) | |
tree | e49bbb9bcb5143d882f1a1293f6ca1721df84efb /spec/features/projects | |
parent | f35d7d7f6ea04a38da822db902ad24108dfe94a2 (diff) | |
parent | 96e0020c70ba69de873067b092626295d8388bf0 (diff) | |
download | gitlab-ce-f7c8434c7100c3c87eb2a75cd5a128e520d8c110.tar.gz |
Merge branch 'replace_spinach_user_lookup.feature' into 'master'
Replace 'project/user_lookup.feature' spinach test with an rspec analog
See merge request !13863
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/commits/rss_spec.rb (renamed from spec/features/projects/commit/rss_spec.rb) | 0 | ||||
-rw-r--r-- | spec/features/projects/commits/user_browses_commits_spec.rb | 44 |
2 files changed, 44 insertions, 0 deletions
diff --git a/spec/features/projects/commit/rss_spec.rb b/spec/features/projects/commits/rss_spec.rb index db958346f06..db958346f06 100644 --- a/spec/features/projects/commit/rss_spec.rb +++ b/spec/features/projects/commits/rss_spec.rb diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb new file mode 100644 index 00000000000..41f3c15a94c --- /dev/null +++ b/spec/features/projects/commits/user_browses_commits_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe 'User broweses commits' do + let(:user) { create(:user) } + let(:project) { create(:project, :repository, namespace: user.namespace) } + + before do + project.add_master(user) + sign_in(user) + end + + context 'primary email' do + it 'finds a commit by a primary email' do + user = create(:user, email: 'dmitriy.zaporozhets@gmail.com') + + visit(project_commit_path(project, RepoHelpers.sample_commit.id)) + + check_author_link(RepoHelpers.sample_commit.author_email, user) + end + end + + context 'secondary email' do + it 'finds a commit by a secondary email' do + user = + create(:user) do |user| + create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) + end + + visit(project_commit_path(project, RepoHelpers.sample_commit.parent_id)) + + check_author_link(RepoHelpers.sample_commit.author_email, user) + end + end +end + +private + +def check_author_link(email, author) + author_link = find('.commit-author-link') + + expect(author_link['href']).to eq(user_path(author)) + expect(author_link['title']).to eq(email) + expect(find('.commit-author-name').text).to eq(author.name) +end |